17

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

45
  • 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 
Sign up to request clarification or add additional context in comments.

2 Comments

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.
I came here looking for a way to see both the cached and uncached changes together, so +1 for mentioning git diff HEAD.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.