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

后端 未结 4 2104
轮回少年
轮回少年 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:39

    The best line endings practice is here: https://stackoverflow.com/a/10855862

    To determine the line endings in a existing git repository:

    1. Set core.autocrlf to false, so it will not change file endings while transmitting files.
    2. git clone your repo for ex. in a new directory.
    3. Use the text editor that shows line endings to open the files (for ex. PHPStorm does). You should open several files as line endings may differ from file to file.

    You can't determine what core.autocrlf was used by the creator as it is local config except the repo has .gitattributes file.

    On Windows if you are not using .gitattributes just use core.autocrlf true as it set by default.

提交回复
热议问题