To reset both the working copy of my-file.txt
and its state in the Git index to that of HEAD:
git checkout HEAD -- my-file.txt
--
means “treat every argument after this point as a filename”. More details in this answer. Thanks to VonC for pointing this out.