git checkout HEAD <pathname>
Restore a file from the most recent commit
The git checkout HEAD <filepath> command is used to revert a specific file from the latest commit in the current branch. It replaces the content of the specified with the version from the latest commit.
Some potential variations include:
git checkout <commit-hash> <filepath>: Checkout the from a specific commit identified by .git checkout -- <filepath>: Discard changes made to the and restore it to the state of the last commit.
Manual page
git checkoutRelated commands