How to have Git store CRLF in index
git-svn at work and people are constantly complaining that I’m committing
LF‘s instead of
CRLF‘s. (We’re mostly a Windows shop).
As far as I can tell, when
true the working copy is
LF, and when
input it’s left untouched. I like the
autocrlf = true as a concept, but I wish it would default to
CRLF in the index since that’s what get’s committed to SVN.
Is there a way to set what line ending the index uses?
core.eol, but this also seems to only set what the working copy uses, not the index.
2 Solutions collect form web for “How to have Git store CRLF in index”
You’ll want to add a file named
.gitattributes to the root of your project. This will force everyone to commit same line ending. In you case, as you want to force
crlf, you’ll add this line in the
* text eol=crlf
Then, you can also normalize every files in your repo once, and never bother about it again: Trying to fix line-endings with git filter-branch, but having no luck
You can also refer to github guide on line ending: https://help.github.com/articles/dealing-with-line-endings
It turns out that
git-svn uses the
svn:eol-style property from SVN to decide how to store the line endings. If you go into a pure SVN checkout & add
svn:eol-style set to
native, Git will use CRLF for Windows and LF for Linux/OSX.
I also have these settings:
$ git config core.autocrlf false $ git config core.safecrlf true
I don’t have anything in my