科普
符号 | 解释 |
---|---|
CR | Carriage Return (ASCII 13, \r) |
LF | Line Feed (ASCII 10, \n) |
CRLF(即\r\n)和LF(即\n)都是换行符。一般来说windows使用CRLF,而linux使用LF。但实际上这和所使用的文本编辑器有关,部分文本编辑器可以选择换行风格。
解释和操作
解释
简单的说,这个警告发生于
- 使用windows上的git
- 你的文本编辑器使用了LF作为换行符
- git add的检查阶段(checkout)而非提交阶段(commit)
- core.autocrlf=true
操作
实际上这个替换是没有必要的,因此可以将core.autocrlf=true设置为false,命令行键入
git config --global core.autocrlf false
参考
stackoverflow:Windows git “warning: LF will be replaced by CRLF”, is that warning tail backward?