0

I am learning to program cross-platform with java, git and eclipse. I read a lot about line endings but I am not sure exactly how to use what. The article of Tim Clem states it very simple: when core.eol is set to native, you get crlf in windows and lf in unix like environments and git translates between the two. That's what I want. However, this article asks me to set core.autocrlf true. Another article asked me to set it to true on windows and input on linux. According to the man pages this overrides core.eol and I do not see the use of that. It adds an extra level of making mistakes.

Next one should start the .gitattributes file with * text=auto and define what exactly text is. What I have trouble to understand is that when the setting of core.eol native seems to be satisfactory, why I should define autocrlf or .gitattributes? As far as I can see Git handles all the conversions and is clever enough to determine which file is text and which is binary. If I do not trust Git's decision making I may specify exactly which files are text and which not in .gitattributes. But why should I define * auto true when core.eol is native?

My question: if core.eol native is insufficient for working cross platform, why is that the case? I am obviously missing some point, but I could not find it out reading the docs because different articles and man pages say different things. Any help will be greatly appreciated.

Community
  • 1
  • 1
Arnold
  • 4,578
  • 6
  • 52
  • 91
  • I think you will get allinfo here: http://stackoverflow.com/questions/3206843/how-line-ending-conversions-work-with-git-core-autocrlf-between-different-operat – S.Spieker Jan 08 '17 at 16:15
  • I refer to the article of Tim Clem, he simply does not explain why `core.autocrlf` is necessary when already `core.eol` is defined. – Arnold Jan 08 '17 at 16:21
  • `autocrlf` is a legacy settings. It *can* override the newer mechanisms for legacy reasons. If you leave it at the default (`false`) then it won’t do anything. – poke Jan 08 '17 at 16:29
  • Ah, `core.eol native` and `core.autocrlf false` will have the desired behavior on both windows and linux). What is the added value of `* text auto` in the `.gitattributes` file? – Arnold Jan 08 '17 at 16:32
  • 1
    With `autocrlf = false`, you *need* to configure line endings in the `.gitattributes` in order to have line ending conversion (which will then respect the `eol` setting). – poke Jan 08 '17 at 17:26

0 Answers0