Operating system: Windows 10
git core.autocrlf = true
.gitattributes
file:
* text=auto eol=lf
*.bat eol=crlf
*.ps1 -text
After pushing to remote:
File name | Local EOL | GitHub EOL |
---|---|---|
test.text | CRLF | LF |
test.bat | CRLF | LF |
test.ps1 | CRLF | CRLF |
(Determining GitHub EOL was done by downloading the raw file and checking its EOL.)
After doing git rm -rf --cached .
and git reset --hard HEAD
:
File name | Local EOL | GitHub EOL |
---|---|---|
test.text | LF | LF |
test.bat | CRLF | LF |
test.ps1 | CRLF | CRLF |
* text=auto eol=lf
: text=auto
- Git will auto-detect whether a file is text or binary. eol=lf
- all text files, unless specified otherwise, will have LF as end-of-line upon checkout.
*.bat eol=crlf
: Files will have LF on the remote repo, but CRLF on the local system.
*.ps1 -text
: The text
attribute is unset, which tells Git not to attempt any end-of-line conversion upon checkin/checkout; files will be as-is. This means that anyone can change the EOL on the remote repo, which may lead to inconsistency.