0

Looking at the .gitattributes file and then at the git documentation https://git-scm.com/docs/gitattributes I understand kind of what it is doing in normalizing line endings to what I would assume is a specific standard, but why is this important and/or useful?

bigmadwolf
  • 3,419
  • 3
  • 30
  • 44
  • Your question presupposes that we should. It's like asking "why should everyone eat only raspberry ice cream". I avoid Windows and as a result, have never had any need for line ending modifications in my repository setups. – torek Jan 26 '17 at 22:25
  • Despite the fact that we're in agreement that Windows should not be ones first choice, my question presumes that there is a motivation behind normalizing line endings and makes no judgment about anyone's preferred flavor of ice cream or OS (notice that the question could be phrased in both the positive and negative). I'd further suggest any moderately decent developer will likely work on projects with others in time, and is often served well by firstly fully understanding the functionality of their tools, and secondly not discriminating against others choices. – bigmadwolf Jan 30 '17 at 21:48
  • Sure—but I think if you rephrase the question, e.g., *when* should one normalize line endings, you will get better answers. – torek Jan 30 '17 at 22:20

1 Answers1

1

For historical reasons, newline in some platforms are marked with CRLF and in other platforms with LF. Because of this, if you mix files with both line endings, for example, many parsers (including the ones written by yourself) and text-processing tools like diff can behave weirdly. There even exists a flag for diff to ignore the line endings.

Asalle
  • 1,239
  • 19
  • 41
  • 1
    Thank you very much for the succinct answer, I'll look up the difference between CRLF and LF, unless you can point me in the direction of some decent reading on it. – bigmadwolf Jan 30 '17 at 21:51
  • @pushplaybang, good to hear. Here are some tips: http://stackoverflow.com/questions/1552749/difference-between-cr-lf-lf-and-cr-line-break-types#1552775 http://adaptivepatchwork.com/2012/03/01/mind-the-end-of-your-line/ – Asalle Jan 31 '17 at 08:33