Hard reset of a single file

Question

How do I discard the changes to a single file and overwrite it with a fresh HEAD copy? I want to do git reset --hard to only a single file.

Answer

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.

Is it possible to have different Git configuration for different projects?

How can I see the size of a GitHub repository before cloning it?