The difference between a thought & a decision…is an ACTION!

Reset Git Branch to undo a pull or a merge

Posted in   Development #Git

This is more a note to myself put here in case anyone searching for the same solution might find it useful. Yesterday I pulled a remote into the wrong local branch and couldn't find a way to reset the branch again to undo my mistake. Fire up your chosen command prompt, which for me is currently the Console2 Command Prompt and enter the following command. [code]git reset --hard ORIG_HEAD[/code] This solution is suitable for undoing a pull or a merge. Full details on the git-reset Manual Page. I still find Git a bit harder to master than Mercurial so I can see me adding a few more short posts on here for my own future reference.


comments powered by Disqus