Take the 2-minute tour ×

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.


$ git status
# On branch master
# Changes to be committed:
#       modified:   foo.java
# Changed but not updated:
#       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.

share|improve this question

marked as duplicate by miku, Daniel DiPaolo, Robert Harvey Mar 9 '11 at 21:30


@miku +1, voted to close as well (and leaving it here because it's best practice apparently), surprised that didn't show up when posting –  Daniel DiPaolo Mar 9 '11 at 18:54

1 Answer 1

up vote 28 down vote accepted

One more minute of Googling found the answer of course, answering my own question:

git diff --cached
share|improve this answer
git diff --staged is a synonim and is more mnemonic for this case –  axeoth Dec 12 '12 at 15:21
