Git 2 · Undoing changes

Discard changes to a file

Restore a file to its last committed state.

git restore file.txt

Caution: Uncommitted changes to the file are lost and cannot be recovered.

Official Git 2 documentation

More undoing changes commands

All undoing changes commands · Git 2 cheatsheet

Was this page helpful?