You want to do this:
git add -u
git reset HEAD path/to/file
git commit
Be sure and do this from the top level of the repo; add -u
adds changes in the current directory (recursively).
The key line tells git to reset the version of the given path in the index (the staging area for the commit) to the version from HEAD (the currently checked-out commit).
And advance warning of a gotcha for others reading this: add -u
stages all modifications, but doesn't add untracked files. This is the same as what commit -a
does. If you want to add untracked files too, use add .
to recursively add everything.