How to cancel last local commit in git

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 .

Posted

in

by

Tags:

Comments

Leave a Reply

%d bloggers like this: