In a file under a git repository. I have only added some code. When I perform a git diff it shows all the entire older version of the file with a “-“, and then displays the entire new version of the file with “+”.
For eg.
print "hello"
print "stack overflow" #new added code
print "world"
with git diff shows up as
-print "hello"
-print "world"
+print "hello"
+print "stack overflow" #new added code
+print "world"
Instead of expected
print "hello".
+print "stack overflow" #new added code
print "world"
This is causing issues with the reitveld Code review tool as well for me.
Am I doing some thing wrong or missing a git config.
Update: Eclipse auto formatted the file, and the spaces went for a toss, and hence the diff was as above. Still there has to be a method to avoid that. Is there anything for that?
Check for invisible whitespace, or different line endings (
CRvsCR/LFvsLF, depending on the platform and editor you used to create or modify the files).