如何从暂存区域获取文件?

时间:2015-06-05 19:43:03

标签: git staging

我有一个文件“a.txt”我做

git add a.txt

现在,我删除a.txt(或修改它)。

然后我想要我已经添加到暂存区域的a.txt

我该怎么做?

1 个答案:

答案 0 :(得分:3)

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
相关问题