Revert file to the last commit state

git checkout -- <file>

 

Remove file from the stage (opposite of git add):

git reset <file>

 

Undo (swap additions and deletions) changes introduced by a commit and commit it:

git revert commit-id

 

Undo changes on a single file or directory from a commit, but retain them in the staged state:

git checkout commit-id <file>

 

Undo changes on a single file or directory from a commit, but retain them in the unstaged state:

git reset commit-id <file>