windows - git - 强制 lf 行结尾不捕获二进制文件

标签 windows git line-endings

根据Force LF line endings using .gitattributes without losing automatic text/binary inference?当我将 .gitattributes 设置为仅包含时

* 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

关于windows - git - 强制 lf 行结尾不捕获二进制文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53480627/

相关文章:

c++ - 如何将我的应用程序带到窗口顶部

git - 可以使用 Android Studio 克隆 TFS 项目

Git rebase 子树

Git - 如何处理相同的存储库但不同的协议(protocol)(http 和 ssh)

regex - 为什么行的开头是 "^"行的结尾是 "$"?

javascript - 预期换行符为 'LF' 但发现 'CRLF' 换行符样式

c# - 创建服务还是后台应用程序?

c - 如何安排两个任务?

PHP file_put_contents 换行

linux - 无法从 Windows 计算机连接到 Linux git Repo