1. Unstage last commit
# undo last commit, keeps file in the staging area
git reset --soft HEAD~1
 
# undo last commit, and unstage the files
git reset --mixed HEAD~1
 
# delete last commit and all code changes
git reset --hard HEAD~1