reset hard only one file code example Example: hard reset single file git checkout HEAD -- my-file.txt