Run the following command:
git reset --merge ORIG_HEAD
The reference ORIG_HEAD will point to the original commit from before the merge.
Here, in the command mentioned above, --merge option has nothing to do with the merge. It is almost like git reset --hard ORIG_HEAD command, but safer since it doesn't touch uncommitted changes.
In addition to that if you do a fast forward merge then you can use git revert to go back to the previous commit:
git reset --hard <commit_before_merge>
you can get the commit id from git log and git reflog and if you can't find the commit id then you can do:
git reset --hard HEAD@{1}
As mentioned above in this answer.