Git false positives after Ubuntu upgrade
Started a Git repository under Ubuntu 9.10. Finally upgraded to 10.04. Current Git is 1.7.0.4.
Now when I edit a file (with gedit) that was last changed before the upgrade, then commit, the commit is full of false-positive changes, ~400 lines out of ~1400.
I use spaces to indent within my source, if that matters.
Edit: a false-positive change looks like
- var a = 1;
+ var a = 1;
Edit: problem is CR/LF changed to LF, so question becomes how to suppress these on commit开发者_开发问答? (And maybe that's not advisable?)
If Git shows these lines as changed, something has changed. If you can’t see what has changed, it’s probably (in) the whitespace. Try viewing the diff in a hexdump (git diff|hexdump -C
), this should show the differences a lot better.
Check the GitHub help on the subject.
In your case, that would be setting this config value:
$ git config --global core.autocrlf input
This will convert everything to LF when committing. It may cause problems if your repository is expected to be in CR/LF.
If you're using Gedit, this plugin would be nice to have in your case.
精彩评论