"git diff" does nothing

Viewed 63981

I presume this is a configuration error somewhere, but I can't figure out where. Regular git commands appear to work fine, but "git diff" does nothing. To be safe, I removed external diff tools from my .gitconfig file. This was installed via MacPorts and is the lates version (1.7.2.2).

What I see is that when I run "git diff" from my workspace, it simply exits, doing nothing.

$ git --version
git version 1.7.2.2
$ git diff
$ 

If I back up one directory, out of my root workspace, typing "git diff" gives me this:

$ git diff
usage: git diff [--no-index] <path> <path>

This may be expected behavior since I'm not under a git repository.

Any ideas on what I can do to troubleshoot this?

6 Answers

This may not apply to all situations, but when I was having this issue it was because I had not added the new files to git and committed. I had mistakenly assumed the differences in the branches would automatically appear in git diff.

I would suggest to anyone stumbling upon this post to make sure they add and commit. Again, this does not apply to every situation, but it did mine and so it may others as well.

Happy coding

Related