Undo a commit that has not been propagated:
git reset --hard HEAD^
For a commit that has been propagated, there is no way to undo. However, the following will create a new commit undoing the previous commit's changes:
git revert HEAD
Undo a commit that has not been propagated:
git reset --hard HEAD^
For a commit that has been propagated, there is no way to undo. However, the following will create a new commit undoing the previous commit's changes:
git revert HEAD