aby*_*byx 65
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
#
Run Code Online (Sandbox Code Playgroud)
non*_*lar 25
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
#
Run Code Online (Sandbox Code Playgroud)