Git 2 · Undoing changes

Undo the last commit and discard the changes

Move the branch back one commit and throw away its changes.

git reset --hard HEAD~1

Caution: Discards uncommitted work too. If you regret it, git reflog can usually find the lost commit.

Official Git 2 documentation

More undoing changes commands

All undoing changes commands · Git 2 cheatsheet

Was this page helpful?