问题
I am currently using Git and all is well on my Windows PC. I have my autocrlf set to true which according to this is correct
https://help.github.com/articles/dealing-with-line-endings
Actually I have no complaints, it seems to work very well, there are some warning now and again but I normally ignore them.
But what does this actually do then? Does this add CR/LF when doing a PULL and then change CRLF to LF when doing a push?
So "ALWAYS" in the repo there are files with "ONLY" LF and not CRLF?
I am about to start development in the same repository with a MAC OS X and Linux, now this is where I get confused, according to GitHub it states that for Windows set Autocrlf to TRUE.
But on Linux / MAC OS X, should I do the same? Linux I know doesn't use the CRLF.
Update
I see various comments on Stack Overflow to not use it as true, but of course I am using 3 types of systems so I suppose this is why it's recommended here?
And Linux is recommended too? but it would never make crlf.
So I suppose the case is, always leave it as true, just in case?
回答1:
Set autocrlf
to true
on OS X as well. It will do the right thing. (In fact, you can also set it on Linux and it will again do the right thing.)
But what does this actually do then? Does this add CR/LF when doing a PULL and then change CRLF to LF when doing a push?
Yes. It transforms files into the local native line ending format when they're checked out locally, and then when they're committed they're automatically transformed back into the canonical line ending format (LF
).
回答2:
This might help answer some of your questions.
Basically, this only really matters if you're using an editor that cannot deal with line endings properly, or one that complains a lot (like Visual Studio).
来源:https://stackoverflow.com/questions/12031212/multiplatform-development-and-autocrlf-option-in-git