git提交提示CRLF和LF的换行处理问题
2018-02-11 11:37
651 查看
CRLF和LF
CRLF 是carriagereturnline feed的缩写。中文意思是回车换行。
LF 是line feed的缩写,中文意思是换行。
git会通过CRLF和LF的配置来对源文件文本进行格式处理。
探究CRLF和LF
安装git到configuring the lien ending conversion时,有三个选项:
commit的时候有时也会有相关Line的处理提示。
为什么会出现这三种处理line endings(行尾结束符)呢?在Git的帮助页面给出了很好的解释:
表达的意思就是git历史原因和各操作系统对行尾处理的不同,git来达到兼容的目的。
git命令配置
三种方式处理的不同
CRLF 是carriagereturnline feed的缩写。中文意思是回车换行。
LF 是line feed的缩写,中文意思是换行。
git会通过CRLF和LF的配置来对源文件文本进行格式处理。
探究CRLF和LF
安装git到configuring the lien ending conversion时,有三个选项:
a.Checkout Windows-style,commit Unix-style line endings. b.Checkout as-is,commit Unix-style line endings. c.Checkout as-is,commit as-is line endings.
commit的时候有时也会有相关Line的处理提示。
为什么会出现这三种处理line endings(行尾结束符)呢?在Git的帮助页面给出了很好的解释:
Reference From:https://help.github.com/articles/dealing-with-line-endings If you're using Git to collaborate with others on GitHub, ensure that Git isproperly configured to handle line endings. Every time you press return on your keyboard you're actuallyinserting an invisible character called aline ending. Historically, differentoperating systems have handled line endings differently. When you view changes in a file, Git handles line endings in its own way.Since you're collaborating on projects with Git and GitHub, Git mightproduce unexpected results if, for example, you're working on a Windows machine,and your collaborator has made a change in OS X.
表达的意思就是git历史原因和各操作系统对行尾处理的不同,git来达到兼容的目的。
git命令配置
$git config --global core.autocrlf true core.autocrlf是git中负责处理line endings的变量,可以设置三个值--true,inout,false 设置为true,添加文件到git仓库时,git将其视为文本文件。他将把crlf变成lf 设置为false时,line-endings将不做转换操作。文本文件保持原来的样子 设置为input时,添加文件git仓库石,git把crlf编程lf。当有人Check代码时还是lf方式。因此在window操作系统下,不要使用这个设置
三种方式处理的不同
CRLF->Windows-style LF->Unix Style CR->Mac Style CRLF表示句尾使用回车换行两个字符(即我们常在Windows编程时使用"\r\n"换行) LF表示表示句尾,只使用换行. CR表示只使用回车.
相关文章推荐
- [Git] Windows下Git提交代码提示warning: LF will be replaced by CRLF
- git换行符LF与CRLF转换问题
- [GIT] warning: LF will be replaced by CRLF问题解决方法
- GIT 提交错误 fatal: LF would be replaced by CRLF
- 解决git提交时提示“git did not exit cleanly (exit code 1)” 问题
- git core.autocrlf配置 解决Windows和Linux(Mac)换行问题
- [GIT] warning: LF will be replaced by CRLF问题解决方法
- [GIT] warning: LF will be replaced by CRLF问题解决方法
- git使用问题解决----warning: LF will be replaced by CRLF
- 【git 问题小说说】 git add时候报错:LF will be replaced by CRLF
- git 提示换行符LF 或者 CRLF
- git 换行符LF与CRLF转换问题
- git问题 warning: LF will be replaced by CRLF in README.md.
- 【git 问题小说说】 git add时候报错:LF will be replaced by CRLF
- git换行符LF与CRLF转换问题
- git的小问题CRLF和LF自动转换的warning
- git默认LF转换为CRLF的问题
- CRLF和LF 关于git中的waring提示
- android studio提交代码到git时提示“No changes detected”的问题
- Git添加报warning: LF will be replaced by CRLF问题解决方法