0

Case1: windows core.autocrlf=true when I change the line endings of a text file to lf these are marked as changes. But they are all normalized when committed so there shouldn't be any changes.

Case2: linux core.autocrlf=input when I change the line endings of a text file to crlf these are marked as changes. But they are all normalized when committed so there shouldn't be any changes.

So why does git flag files as changed when only the line endings are changed and normalization is on?

1 Answers1

0

From the git documentation regarding autocrlf:

Git can handle this by auto-converting CRLF line endings into LF when you add a file to the index, and vice versa when it checks out code onto your filesystem.

This is what it the option does, in a nutshell. It does not pervade every single operation of git, only git add and git checkout (and similar, i.e., git reset and probably others that change your working directory).

You might want to look into the text attribute in .gitattributes; maybe that's closer to what you need.

AnoE
  • 8,048
  • 1
  • 21
  • 36