To abort a merge

git merge --abort

Undo Latest Commit

git reset --hard HEAD~1     # undo latest commit

Go to a commit by completely removing the history (reset)

git reset --hard <commit_hash>

Restore your working directory to a clean state:

git checkout -- .