Question

I have read lots of posts about CRLF & LF issues in git, i'm going to ask you if you consider correct this .gitattributes config:

# Autodetect text files
* text=auto

*.* eol=lf

In my repo we have a lot of sripts (some with sh extension, some without extension...) that run in linux environment so in a default git config and in a windows environment those scripts have CRLF when checkouts and it fails. To accomplish that, i introduce in all files the LF line ending. I think there's no problem because git distinguishes between binary and text files. And for the rest of files: '.php', '.c', '.js', all window developers should not have problems displaying these files because they should have 'good ide's or text-editors'. Do you think that .gitattributes config is good?

Was it helpful?

Solution

With text=auto you already get LF line endings for all text files in the Git repository.

With eol=lf, you in addition only prevent that text files are converted to CRLF on checkout on Windows. If you only want to make sure that the files have LF in a checkout on a Linux system, you don't need that configuration.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top