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.

Now,

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.

https://stackoverflow.com/questions/39877748/git-diff-whats-the-difference-between-cached-and-staged

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *