16

Say I do

git add foo.txt

Now, foo's changes are in the index (I'm assuming git was already tracking that file). Now, when I do git diff, I can't see the changes in foo by doing

git diff

Are there some extra things that git diff wants before it shows me those changes?

1

1 Answer 1

43
  • To show unstaged changes only:
git diff
  • To show the staged/cached changes only:
git diff --cached
  • To show both cached and uncached changes, compare the whole working tree to the named commit (HEAD):
git diff HEAD
2
  • ooh. Thanks! Why so many words for 1 concept! Let me see if I got this straight: staged (or cached) changes = changes that live in the index. Commented Jul 31, 2010 at 9:27
  • 6
    I came here looking for a way to see both the cached and uncached changes together, so +1 for mentioning git diff HEAD.
    – undefined
    Commented Mar 1, 2018 at 17:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.