git replacing LF with CRLF

前端 未结 20 1640
眼角桃花
眼角桃花 2020-11-21 23:31

Running git on a Windows XP machine, using bash. I exported my project from SVN, and then cloned a bare repository.

I then pasted the export into the bare repositori

20条回答
  •  野的像风
    2020-11-22 00:10

    Most of tools in Windows accepts only LF in text files. For example you can control the behaviour for Visual Studio in a file named '.editorconfig' with following example content (part):

     indent_style = space
     indent_size = 2
     end_of_line = lf    <<====
     charset = utf-8
    

    Only the original Windows-Notepad does not work with LF but there are some more proper simple editor tools available!

    Hence You should use LF in text files in Windows too. This is my message, stronlgy recommended! There is no reason to use CRLF in windows!

    (The same discussion is using \ in include paths in C/++, it is bullshit, use #include with slash!, It is the C/++ standard and all microsoft compilers support it).

    Hence the proper setting for git is

    git config core.autocrlf false
    

    My message: Forget such old thinking programs as dos2unix and unix2dos. Clarify in your team that LF is proper to use under Windows.

提交回复
热议问题