git * text = auto在gitattributes文件和行结尾中

时间:2015-11-23 13:54:40

标签: git gitattributes

基于这篇文章: __index 如果.gitattributes文件中包含以下内容,则行结尾将转换为 LF 用于文本文件:

* text=auto

我刚刚在本地存储库上测试了这个:

$ git add -A
warning: LF will be replaced by CRLF in [bla]/.gitattributes.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in [bla]/.gitignore.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in [bla]/README.md.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in [bla].csproj.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in 

但是它说它会转换为 CRLF 。在上面的帖子中,它表示它将转换为 LF ,而在此测试中并非如此。

所以看来:

* text=auto

将基于操作系统转换为行结束类型(Windows的CRLF和Linux的LF)。但这不是这里描述的内容:

What is the purpose of `text=auto` in `.gitattributes` file?

根据以下评论/答案,似乎是由此产生的警告:

* text=auto
<。>在.gitattributes文件中:

warning: LF will be replaced by CRLF in [bla]/README.md.
The file will have its original line endings in your working directory.

实际上意味着当您执行检查 - 输出(下次将文件从存储库签出到工作目录)时,目前 LF 结尾的文本文件将是转换为 CRLF

警告 NOT 地址在检查 行中会有 LF 结尾,这是文档中所说的:

https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

设置为字符串值&#34; auto&#34; 当文本设置为&#34; auto&#34;时,路径将标记为自动行结束标准化。如果Git决定内容是文本,则在签入时其行结尾将标准化为LF。

0 个答案:

没有答案
相关问题