Undo a commit

git reset HEAD~

This leaves your working tree (the state of your files on disk) unchanged but undoes the commit and leaves the changes you committed unstaged (so they’ll appear as “Changes not staged for commit” in git status, and you’ll need to add them again before committing).

 

Source: https://stackoverflow.com/a/927386/2179668

Advertisements