Noam Noam - 1 year ago 81
Git Question

git: Why doesn't git diff show any differences?

If I run 'git status' on my repo it gives:

# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
# modified: myfile

However, if I do a 'git diff myfile' it shows no differences. Is this because I have made a change and removed it so it is back to the original?

Should I run 'git checkout myfile' to clear it?

Answer Source

Your file is already staged to be committed. You can show it's diff using the --cached option of git.

git diff --cached myfile

To unstage it, just do what git status suggests in it's output ;)

You can check The Git Index For more info.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download