FYI (solved): Line ending issue when switching between 2.4 and trunk in one git repo

Christian Stimming christian at
Fri Mar 29 16:29:59 EDT 2013

I have one local git repo with 2.4 and trunk branch in there. I regularly 
switch the checkout between both branches, e.g. for back-porting commits and 

Recently it occurred to me that when doing something on the 2.4 branch and 
then switching the working copy to trunk again, suddenly several files in 
packaging/win32 were reported to have changed. Obviously those reported 
changes can only originate from line ending issues.

Turns out the "problem" is that in January, our trunk branch got a 
".gitattributes" file that finally unambiguously specifies the expected line 
endings for all various files that exist in our repo. However, the 2.4 branch 
does not have that file. Hence, the local git client switches betwenn 
different line ending policies when switching between 2.4 and trunk! 

In 2.4 (the "old system" in the article linked below) the local core.autocrlf 
setting is the important configuration option, and in this case autocrlf=false 
should probably get rid of unwanted line ending changes. For whatever reason 
this was not enough, unfortunately.

Eventually I settled on the following solution: When switching from 2.4 to 
trunk, I temporarily remove the (newly appeared) .gitattributes file, then the 
spurious file changes disappear, and I can revert the .gitattributes removal 
again. Not the most elegant solution but at least it works and doesn't require 
larger line ending changes on the 2.4 branch. Once we drop the 2.4 branch, 
this issue will disappear as well.

Further reading:



More information about the gnucash-devel mailing list