Post Pic

Reset Git Branch to undo a pull or a merge

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.

git reset --hard ORIG_HEAD

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.

Umbraco Certified Developer
SagePay Approved Partner
Creative Market