Rewind history to before your commit. Your files go back to the unstaged state — nothing is lost.
git reset HEAD^ This moves HEAD back one commit. Your changes are preserved as unstaged modifications. You can re-edit and recommit however you want.
If you want to undo the commit but keep files in the staging area:
git reset --soft HEAD^ --soft keeps everything staged. Useful if you just want to amend the commit or split it into multiple commits.
If you want to completely discard the commit and all changes:
git reset --hard HEAD^ --hard deletes your changes. They will not be in your working directory anymore. Use this only if you're sure you don't want the changes.