The best explanation of how core.autocrlf
works is found on the gitattributes man page, in the text
attribute section.
This is how core.autocrlf
appears to work currently (or at least since v1.7.2 from what I am aware):
core.autocrlf = true
- Text files checked-out from the repository that have only
LF
characters are normalized toCRLF
in your working tree; files that containCRLF
in the repository will not be touched - Text files that have only
LF
characters in the repository, are normalized fromCRLF
toLF
when committed back to the repository. Files that containCRLF
in the repository will be committed untouched.
core.autocrlf = input
- Text files checked-out from the repository will keep original EOL characters in your working tree.
- Text files in your working tree with
CRLF
characters are normalized toLF
when committed back to the repository.
core.autocrlf = false
core.eol
dictates EOL characters in the text files of your working tree.core.eol = native
by default, which means working tree EOLs will depend on where git is running:CRLF
on a Windows machine, orLF
in *nix.- Repository
gitattributes
settings determines EOL character normalization for commits to the repository (default is normalization toLF
characters).
I’ve only just recently researched this issue and I also find the situation to be very convoluted. The core.eol
setting definitely helped clarify how EOL characters are handled by git.