Is there a way to determine the line endings in a existing git repository?
If I clone a existing repository how do I determine what core.autocrlf was used by the creator?
I'm still uncertain whats the best setting for core.autocrlf e.g on a windows box (since there are multiple opinions: Distributing git configuration with the code or https://help.github.com/articles/dealing-with-line-endings)
Bonus question: Can you determine on windows (with standard tools) if a repo has mixed line endings (by wrong core.autocrlf setting) through all commits?
I mentioned in "
git statusshows files as changed even though contents are the same" thatgit ls-files --eolis a good approach. (Git 2.8+)Example:
That being said:
I would still maintain that setting (
core.autocrlf) tofalse, as I explain in "Distributing git configuration with the code" that you mention, and useseolgitattributes directive for a more fine-grained control.That being said, to detect a mixed line endings:
core.autocrlftotruegit cloneyour repogit diff: if diffs are visible just after your clone... some automatic eol conversions just took place in the working tree.Update 2016 (4 years later): a more modern way to detect eol changes: