How can I get Git to truly *ignore* line endings? How can I get Git to truly *ignore* line endings? git git

How can I get Git to truly *ignore* line endings?


For future reference: the most stable way to implement this, is using a .gitattributes file that is committed in the root of the git repository.

This file should contain the following:

# no eol conversions!* -text

This means the following:

  • [*]: this is a file filter and matches any file
  • [-text]: do not attempt to do any end-of-line conversion upon check-in and check-out

Note: using "text=auto" would mean: use the native end-of-line format on the checked out file (for anything that looks like text) and store it as "LF" internally.

This is robust because everyone that clones the repository will be using the same settings. (This is not the case when using core.autocrlf.)

See also Git documentation on gitattributes (effects: text).