Git Commands

This is purely a space for me to keep a reference to the git commands I don’t use often enough to remember.

Undo The Last Commit

So, you have just commited something and realised you didn’t want to do that….

To undo the commit, but keep the changes:

git reset --soft HEAD~1

To undo the commit and throw away the changes – in other words, reset the branch back to how it was before you started fiddling with it:

git reset --hard HEAD~1