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.
One more minute of Googling found the answer of course, answering my own question:
git diff --cached