Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (19.4k points)

I want to force git to checkout files under Windows using just LF not CR+LF. I checked the two configuration options but I was not able to find the right combination of settings.

I want it to convert all files to LF and keep the LF on the files.

Remark: I used autocrlf = input but this just repairs the files when you commit them. I want to force it to get them using LF.

Probably I wasn't so clear: the repository is already using LF but the files checked out using msysgit are using CR+LF and I want to force msysgit to get them with LF: forcing Unix line endings.

>git config --list | grep crlf


1 Answer

0 votes
by (27.5k points)

In case you want to force all users to have LF line endings for text files and you can't ensure that all users change their git config, you can do that starting with git 2.10. 2.10 or later

Let us talk about the solution: 

Just put a .gitattributes file in the root of your git repository having following contents:

* text=auto eol=lf

Commit it.

Browse Categories