go back commits on a single file code example Example: git revert one file git checkout HEAD -- /directory/my-file.txt