git - 强制 lf 行结尾不捕获二进制文件
git - force lf line endings does not catch binaries
根据 Force LF line endings using .gitattributes without losing automatic text/binary inference? 当我将我的 .git 属性设置为仅包含
* text=auto
* text eol=lf
然后所有文本文件都应转换为 LF 行结尾,二进制文件应保持不变 - 这就是我想要的。但是不知何故,这里没有正确检测到二进制文件。在 Windows 下查看 git bash 控制台的输出:
$ git add .
warning: CRLF will be replaced by LF in clip2txt.exe.
The file will have its original line endings in your working directory
warning: CRLF will be replaced by LF in raw.png.
The file will have its original line endings in your working directory
warning: CRLF will be replaced by LF in test.
The file will have its original line endings in your working directory
我本以为 raw.png 和 clip2txt.exe 会被忽略,因为它们是二进制文件。文件测试会正确转换,没问题。
我是不是漏掉了什么?`
谢谢你,
br 亚历克斯
如果有人正在调查此问题,我将其标记为已回答:
解决方案是将 .gitattributes 设置为
* text=auto eol=lf
感谢@phd
根据 Force LF line endings using .gitattributes without losing automatic text/binary inference? 当我将我的 .git 属性设置为仅包含
* text=auto
* text eol=lf
然后所有文本文件都应转换为 LF 行结尾,二进制文件应保持不变 - 这就是我想要的。但是不知何故,这里没有正确检测到二进制文件。在 Windows 下查看 git bash 控制台的输出:
$ git add .
warning: CRLF will be replaced by LF in clip2txt.exe.
The file will have its original line endings in your working directory
warning: CRLF will be replaced by LF in raw.png.
The file will have its original line endings in your working directory
warning: CRLF will be replaced by LF in test.
The file will have its original line endings in your working directory
我本以为 raw.png 和 clip2txt.exe 会被忽略,因为它们是二进制文件。文件测试会正确转换,没问题。
我是不是漏掉了什么?` 谢谢你, br 亚历克斯
如果有人正在调查此问题,我将其标记为已回答:
解决方案是将 .gitattributes 设置为
* text=auto eol=lf
感谢@phd