You can undo a commit by reverse merging a change:
What this basically does is it will add changes to your project that revert what you did in the previous commit. You can then commit those changes again. You'll still see it in your commit history, but the changes will be undone.