GuardianX
GuardianX

Reputation: 512

.gitattributes control commited end of line symbols

I use GIT. I want to disallow eol conversion for text file. For example, if someone in my project has the file with CRLF and someone else has the file with LF, I want all of the checkin and checkout the files with those corresponding end line symbols. I read about .gitattributes, but I didn't understand it completely, since as far as I understood it only able to mark some files as text and other ones as binary. Also there is -text property, which is "text not set" however I don't get if this is the same as binary. Note that I want to have my merges to work correctly for both types of files - with CRLF and LF too.

Upvotes: 1

Views: 103

Answers (1)

Philip Daniels
Philip Daniels

Reputation: 1024

See Git line endings after normalization

TL;DR Just create a .gitattributes file in the root of your repo with the two lines:

* -text
* whitespace=cr-at-eol

This will turn off all line ending normalization by Git and leave it up to you to manage.

Upvotes: 1

Related Questions