views:

40

answers:

3

For some reason my editor looks like it is occasionaly changing changing the line endings of my source files. When I do 'git diff', all i get is a mysterious empty '-' followed by a '+', but no information to confirm this was teh actual change. How do I get git diff to show me what this change actually was ?

A: 

Very vague. But the best advice would be to use an editor that is aware of differing lineend characters/sequences. vi is a good choice. notepad is not.

David Watson
Thanks, I'm using Vim, however somehow it's playing tricks. I'd like to know how to get git to tell me what the changes were.
Stonky
A: 

use "git diff -w" to review the diff without whitespace change such as \r, \t etc

also with "git log -p -w" or "git show -w"

Cotton
Yes - but I want to see the whitespace change, and what whitespace was changed to what other whitespace.
Stonky
use "git difftool" to review diff with default difftool which vimdiff; After launch vim, use command "set list" to trigger viewing of whitespace; Also "set listchars=" to specify the including of whitespace, use command "help listchars" to see more
Cotton
A: 

Sometimes a graphical diff tool will show you the change better -- try git difftool.

bstpierre