Make Git use CRLF on its “<<<<<<< HEAD” merge lines

后端 未结 3 1560
滥情空心
滥情空心 2020-12-09 05:58

Is it possible to ask Git to use CRLF instead of just LF at the end of the lines it puts into a file when it needs merging?

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-09 06:32

    There is no setting which controls the line endings used for the "<<<<" markers in git; they are hardcoded to use '\n' in the git source code (see line 173 of xmerge.c).

    If you set the "eol" or "core.eol" settings to "crlf", then the "<<<<" markers will have \r\n line endings in the file (this happens during the smudge/clean filter step, after the code linked above), but this has a major side-effect: the files will be "normalised" on their way into the repository, so you will commit files with unix line endings.

    This is likely to be not what you want on a .Net project like the example above.

    So I don't have a good answer for you, sorry.

提交回复
热议问题