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 开发者_Python百科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?
- 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
精彩评论