View diff of staged changes in git
Possible Duplicate:
How do I show the changes which have been staged?
Is there a simple way to view the diff of only the staged changes I have pending in git? I've staged several files but want to take one last look at what I'm committing before I push the button. I have several other unstaged changes that I want to go in a separate commit, so unstaging, doing git diff
, and then paging through to the file I want isn't all that desirable an option.
Example:
$ 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
I really just want to see what I changed in foo.java
without having to unstage.
再过一分钟Google就找到了答案,回答我自己的问题:
git diff --cached
链接地址: http://www.djcxy.com/p/50864.html
上一篇: 用于添加文件的Git diff
下一篇: 查看git中分阶段更改的差异