bigmadwolf
bigmadwolf

Reputation: 3539

Why should we normalize line endings using `text=auto` in `.gitattributes` file?

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?

Upvotes: 0

Views: 74

Answers (1)

Asalle
Asalle

Reputation: 1337

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.

Upvotes: 1

Related Questions