Imagine you have made few local commits
and you don't want to commit all of them. Instead you want to go back to the master branch state.
git reset --hard origin/master // This won't work!
Setting
your branch to exactly match the remote branch can be done in two
stepsgit fetch origin
git reset --hard origin/master
If
you want to save your current branch's state before doing this (just
in case), you can do:
git commit -a -m "Saving my work, just in case"
git branch my-saved-work
No comments:
Post a Comment