git checkout -- a.txt
Другой ответ на этой странице не имеет --
, что привело к некоторой путанице.
Это то, что Git сообщает вам, когда вы вводите git status
:
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: a
#
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: a
#