| 系统名称 | 行结束符 | 意义 | 释义 | git line endings选项 |
|---|---|---|---|---|
| DOS / Windows | \r\n | CRLF | ‘\r’是使光标移动到行首 ’\n’是使光标下移一行 | Windows-style |
| MacOS | \r | CR | return | As-is |
| UNIX / Linux | \n | LF | newline | Unix-style |
在学习git软件,安装git到configuring the line ending conversion时,有三个选项。
a. Checkout Windows-style,commit Unix-style line endings.(签出CRLF,提交签入是LF)
b.Checkout as-is,commit Unix-style line endings.(签出CR,提交签入是LF)
c.Checkout as-is,commit as-is line endings. (签出CR,提交签入是CR)
这里面讲到了做两个操作(Checkout,Commit)的三种处理line endings的操作(Windows-style,Unix-style,As-is)。
CRLF->Windows-style
LF->Unix Style
CR->Mac Style
core.autocrlf 的配置true false inout,
If core.autocrlf is set to true, that means that any time you add a file to the git repo that git thinks is a text file, it will turn all CRLF line endings to just LF before it stores it in the commit.。
If core.autocrlf is set to false, no line-ending conversion is ever performed, so text files are checked in as-is. This usually works ok。