如何从暂存区获取文件?
how to get a file from the staging area?
我有一个文件"a.txt"我有
git add a.txt
现在,我删除 a.txt(或修改它)。
然后我想要 a.txt 我已经添加到暂存区
我该怎么做?
git status
的输出包含您要查找的信息:
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
因此,在这种情况下,您应该 运行:
git checkout -- a.txt
我有一个文件"a.txt"我有
git add a.txt
现在,我删除 a.txt(或修改它)。
然后我想要 a.txt 我已经添加到暂存区
我该怎么做?
git status
的输出包含您要查找的信息:
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
因此,在这种情况下,您应该 运行:
git checkout -- a.txt