How to see diff between working directory and staging index?

  • git diff - Compare working area to index.
  • git diff --staged - Compare stage area to repository.
  • git diff HEAD - Compare working area to repository

To illustrate that, I changed a file with “Name Staged” text and than I added it (git add .). After that, I changed the file again, now I replaced the text to “Name Working Area” and than I run the follow commands:

enter image description here

Now you can see clearly how it works. Pretty cool, right?


Actually, git diff is between index and working tree. It just so happens that until you have staged changes to the index (with git add) that its contents will be identical to the HEAD commit.

git diff HEAD is between repo and working tree.

See 365git.tumblr.com post:

git diffs

Tags:

Git

Git Diff