34

可能重复:
我如何显示已上演的更改?

有没有一种简单的方法来查看我在 git 中待处理的分阶段更改的差异?我已经上演了几个文件,但想在按下按钮之前最后看一下我正在提交的内容。我还有其他几个未暂存的更改,我想在单独的提交中进行,因此取消暂存,执行git diff,然后分页到我想要的文件并不是一个理想的选择。

例子:

$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   foo.java
#
# Changed but not updated:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   bar.java
#       modified:   baz.java
#       modified:   qux.java

我真的只是想看看我改变了什么,foo.java而不必取消舞台。

4

1 回答 1

55

一分钟的谷歌搜索当然找到了答案,回答了我自己的问题:

git diff --cached
于 2011-03-09T18:51:16.247 回答