Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force SourceTree ignore line endings in git files

There are so many posts but still the resolution is not clear or isn't working for me. Problem seems to be well known..

  1. I checked out my project in unix and git status shows no differences. Settings here:

    bash-3.2$ git config core.autocrlf
    false
    bash-3.2$ git config core.whitespace
    cr-at-eol
    
  2. But I also like to use SourceTree (pointing to the same Unix code base through NFS mount) for some conveniences. Settings for those above attributes are exactly same.
    But SourceTree shows a bunch of differences in based on purely line endings.

What is the straightforward solution for this?
How come SourceTree has no settings in the UI around this?

like image 348
endless Avatar asked Jun 02 '15 18:06

endless


1 Answers

There is a gear icon near the diff-ui section of the SourceTree app that show your file difference, you can click on it and set it to show whitespace or ignore whitespace!! I googled for hours, and finally got the answer after searching for SourceTree equivalent of the git command:

Git version <= 1.8.3.4:
git diff --ignore-space-at-eol -b -w [commit] ...

Git version >= 1.8.4:
git diff --ignore-space-at-eol -b -w --ignore-blank-lines [commit] ...

See the options definition below:

--ignore-space-at-eol 
Ignore changes in whitespace at EOL.

-b 
--ignore-space-change 
Ignore changes in amount of whitespace. This ignores whitespace at line end, 
and considers all other sequences of one or more whitespace characters to be 
equivalent.

-w 
--ignore-all-space 
Ignore whitespace when comparing lines. This ignores differences even if one 
line has whitespace where the other line has none.

[git version 1.8.4+]--ignore-blank-lines 
Ignore changes whose lines are all blank.

The screen shot

References:

The git command equivalent

Source Tree app settings

like image 187
Zennichimaro Avatar answered Oct 23 '22 16:10

Zennichimaro