GitCheatSheet.org logo
Home / How To

Revert file using "git checkout --"

git checkout -- fileToRevert.txt

Replaces the file in the working directory by the latest staged or commited file. WARNING: any local changes made to the file are lost. Git replaces the file with the last staged or committed version.