Reputation: 2145
I'd like to set up git such that it changes all LF endings to CRLF.
I've created a .gitattributes file in my root folder of my repo:
* text=auto
# Have git change every .groovy and .java file to crlf
*.java eol=crlf
*.groovy eol=crlf
And when committing a .java file that I know has LF endings I'd expect it to change to CRLF when checking out to a new local branch. But it doesn't. Any thoughts?
Upvotes: 2
Views: 498
Reputation: 2145
So I found the issue. I was using Egit, where .gitattributes is not currently supported properly yet. See This Link. Currently unresolved.
Upvotes: 2
Reputation: 165
I believe you need to specify "text" before the "eol" attribute; so your example would become the following:
* text=auto
# Have git change every .groovy and .java file to crlf
*.java text eol=crlf
*.groovy text eol=crlf
Upvotes: 2