How to revert or rollback your most recent merge in git
Risky operations like a merge can sometimes leave you unhappy if the merge turned out to be too messy to clean. You can use the below command to go back the the state just before your merge. NOTE: This is best used only for merges that you haven't pushed upstream.
git reset --hard ORIG_HEAD
The ORIG_HEAD always points to the commit in the current branch before the merge. Although this is nice to have for a 3 way merge, a great side effect of this command is that if you did a fast forward merge that had 10 fast forwarding commits, you can directly go back to the commit that you were on just before the merge operation by using the above command. That way you dont need to count how many commits you want to go back in history for to revert a fast forward merge.