LF or CRLF - What are the best practices for this in Git?

Hi all,

So I’m trying to utilize Git and Github more, and am curious/ confused about what is the best config in regards to line endings - LF and CRLF.

I’m a Mac user, and am currently not collaborating on any projects/ repos with anyone; thus, leaving files in LF would seem fine. Therefore, setting it to git config --global core.autocrlf input as opposed to the standard core.autocrlf true.

I’ve been referencing Git - Formatting Whitespace, yet am still unclear of the best approach.

Would it be best to change to input or just leave it to convert to CRLF as true? Any input on this or best practices would be greatly appreciated. Thanks in advance!

I can’t say I’ve ever run into issues using the default. I almost exclusively commit from Linux, but even still when I work from Windows I use an IDE which I imagine handles line breaks in a “graceful” way.

Unless you’re writing code in MS Word I’d be curious to see an issue crop up.

2 Likes