Diffs between working directory and staged

Say you have modified files README.md and code.c.

You’ve added README.md to the index (i.e. git add README.md) but code.cis still in the Working Directory.


git diff will only show the diff for code.c

To see the diff for README.md use:

git diff --staged

Now, if we change README.mdagain, this change is in the working directory.

Note: --cached is synonymous with --staged.