Using git reset to Undo a Merge:
To undo last merge you only need to checkout last commit that was done before merging any other branch in to current branch using git reset --hard commitSHA
git reset --hard commitSHA
If you don't know SHA of last commit you also do that using the following command
git reset --hard HEAD~1
How to Undo a Pushed Merge:
You can also undo a pushed merge that is pushed on your remote repo using the following command.
git revert -m 1 commitSHA
git revert
is a better solution in case if you have already pushed to a remote repo.
How to find hash id of your commit
Use the git log command to find the hash (SHA) id of your last commit