git reset --soft HEAD~1
Use this if you want to undo the commit, but keep your changes visible and staged for further modifications.
git reset --hard HEAD~1
Use this if you want to undo the commit and discard your changes completely.