Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.gitattributes file not being respected by SourceTree

I've set the contents of the .gitattributes file at my project's root to this:

members/2/dist/** text eol=LF
members/2/contacts/details/view/health/build/** text eol=LF

members/2/framework/cr.compressed-paths.js text eol=LF
members/2/framework/cr.loaderConfig.js text eol=LF

Files nested under both the dist/ and health/build paths should be stored with LF endings. These files are all auto-generated from various Windows processes and that's what (seems) to be used. And of course there's a members file right at the root of my project.

After running said process, I see pending changes under both of those directories, but with no visible changes shown in SourceTree. Trying to commit yields this error:

warning: LF will be replaced by CRLF in members/2/contacts/details/view/health/build/allergy-component-bundle.js. The file will have its original line endings in your working directory.

Is my .gitattributes file set up wrongly? Why is SourceTree trying to convert back to CRLF when .gitattributes says to use LF?

I'll also note that switching over to tortoiseGit shows these same files as changed, so it would seem that the problem is with my git configuration as opposed to SourceTree.

like image 678
Adam Rackis Avatar asked Nov 17 '25 15:11

Adam Rackis


1 Answers

It appears as though the best way to fix this is to just turn off normalization like so

members/2/dist/** -text
members/2/contacts/details/view/health/build/** -text

members/2/framework/cr.compressed-paths.js -text
members/2/framework/cr.loaderConfig.js -text
like image 67
Adam Rackis Avatar answered Nov 19 '25 07:11

Adam Rackis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!