allyourcode
allyourcode

Reputation: 22603

How do I see changes in the git index?

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?

Upvotes: 16

Views: 2976

Answers (1)

Lajnold
Lajnold

Reputation: 3359

  • 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

Upvotes: 44

Related Questions