I keep forgetting this. If you want to delete the latest commit that you have not pushed, you can do it using:
$ git reset HEAD~1
This will remove the commit and leave your changes untouched. If you want to get rid completely of the change, you can use
$ git checkout .