Why should I use core.autocrlf=true in Git?

I have a Git repository that is accessed from both Windows and OS X, and that I know already contains some files with CRLF line-endings. As far as I can tell, there are two ways to deal with this:

  1. Set core.autocrlf to false everywhere,

  2. Follow the instructions here (echoed on GitHub’s help pages) to convert the repository to contain only LF line-endings, and thereafter set core.autocrlf to true on Windows and input on OS X. The problem with doing this is that if I have any binary files in the repository that:

    1. are not correctly marked as binary in gitattributes, and
    2. happen to contain both CRLFs and LFs,

    they will be corrupted. It is possible my repository contains such files.

So why shouldn’t I just turn off Git’s line-ending conversion? There are a lot of vague warnings on the web about having core.autocrlf switched off causing problems, but very few specific ones; the only that I’ve found so far are that kdiff3 cannot handle CRLF endings (not a problem for me), and that some text editors have line-ending issues (also not a problem for me).

The repository is internal to my company, and so I don’t need to worry about sharing it with people with different autocrlf settings or line-ending requirements.

Are there any other problems with just leaving line-endings as-is that I am unaware of?

6 Answers
6

Leave a Comment