git merge --abort
git reset --hard HEAD~1 # undo latest commit
git reset --hard <commit_hash>
Restore your working directory to a clean state:
git checkout -- .