You can undo the last commit:
git reset --soft HEAD~
Or you can undo the time before last time commit:
git reset --soft HEAD~2
Or you can undo any previous commit:
git reset --soft <commitID>
(you can get the commitID using git reflog
)
When you undo a previous commit, remember to clean the workplace with
git clean
You can find more details in the docs: git-reset
hope this helps