Is there a way to determine the line endings in a existing git repo?

后端 未结 4 2110
轮回少年
轮回少年 2020-12-16 10:17

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 cre

4条回答
  •  情话喂你
    2020-12-16 10:56

    I would still maintain that setting (core.autocrlf) to false, as I explain in " Distributing git configuration with the code" that you mention, and uses eol gitattributes directive for a more fine-grained control.

    That being said, to detect a mixed line endings:

    • set core.autocrlf to true
    • git clone your repo
    • git 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:

     git -c color.diff.whitespace="red reverse" diff -R -- afile
    

提交回复
热议问题