From here, there are 3 options to undo that commit.
1. Undo commit and completely remove all changes
git reset --hard HEAD~;
2. Undo commit and unstage all files
git reset HEAD~;
or
or
git reset --mixed HEAD~;
3. Undo commit and keep all files staged
git reset --soft HEAD~;