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.
Git 2 · Undoing changes
Restore a file to its last committed state.
git restore file.txt
Caution: Uncommitted changes to the file are lost and cannot be recovered.
Was this page helpful?