Reputation: 6842
I am looking for some advise on how to do this better. This is the sequence of events:
git reset --hard HEAD~2
to ignore the local changeset and pull again from the masterWhat would be the best way to handle this? Now the changes were small but if it gets bigger then I don't think it is a good idea to just delete my last commits.
Please advice
Upvotes: 0
Views: 223
Reputation: 224962
Push your changes from a different branch than the one you're tracking on the remote. That is, only update your local master
by pulling, and push only from non-master
branches. Workflow something like:
git co master # switch to master branch
git pull # update from origin
git co -b work # make a working branch
... # work work work
git commit -m "My #1 commit message" # commit
git push HEAD:refs/publish/master # push to gerrit for publishing on master
... # wait wait wait
git co master # switch to master branch
git pull # update...
etc, etc etc.
Upvotes: 1