Giustino Borzacchiello

How to cancel last local commit in git

2015-08-04

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

$ git checkout .