1

In a particular repository, I have unstaged changes in tracked files. When I run git diff in that folder, I get no output(and no error). However, if I use gitk(as myself) or run git diff as root, I can see the changes.

I've tried removing my ~/.gitconfig and all zsh config files, and also with bash.

6
  • What do you see in git status? Check your .gitignores. Commented Jan 12, 2014 at 23:19
  • Does it happen for a new repo? Just run git init, echo hello>test.txt, git add test.txt, git commit -m "hi", echo world>>test.txt, then check git diff Commented Jan 12, 2014 at 23:19
  • @slaks: Git status shows that the file has been modified. I doubt its a gitignore issue since it works with gitk and in shell as root. Commented Jan 12, 2014 at 23:21
  • Can you check ownership (and permissions) of files in the .git directory using ls -alR? Commented Jan 12, 2014 at 23:22
  • @CharlesB I'm experiencing the same problem with a new repository. Commented Jan 12, 2014 at 23:24

1 Answer 1

4

It might be a problem with the pager (usually more or less) Git uses for outputing the diff.

Use git --no-pager diff, and check your PAGER environment variable.

Reference: How do I prevent git diff from using a pager?

Sign up to request clarification or add additional context in comments.

3 Comments

AAH, that was it!, this was caused by less using -F but not -X. Thanks!
Maybe next time I should just post on SO before spending hours trying every configuration :P
Nothing is lost, you might have learned a lot trying and searching all these things :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.