gpt4 book ai didi

windows - 在 Windows 中覆盖 .gitattributes text=auto

转载 作者:可可西里 更新时间:2023-11-01 14:03:14 25 4
gpt4 key购买 nike

这很不直观:

C:\python-tdl\examples\termbox>git config core.autocrlf
false

C:\python-tdl\examples\termbox>git commit termbox.py
warning: LF will be replaced by CRLF in examples/termbox/termbox.py.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in examples/termbox/termbox.py.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in examples/termbox/termbox.py.
The file will have its original line endings in your working directory.
Aborting commit due to empty commit message.

根据带有 core.autocrlf=false 的各种媒体,应该根本没有换行转换。

在项目根目录中,我发现 .gitattributes 包含以下行:

# Auto detect text files and perform LF normalization
* text=auto

如果我评论它,警告就会消失。问题 - 如何自动覆盖此 .gitattibutes 设置?

最佳答案

.gitattributes 覆盖所有配置设置,所以它真的不能被覆盖;可以这么说,它是“覆盖者”。虽然您可以简单地删除该行,但这会导致其他开发人员的机器出现不一致的行为,如果他们有 core.autocrlf=true。所以最好的办法是将以下行添加到 .gitattributes:* -text。这将禁用所有文件的 CRLF 处理。

关于windows - 在 Windows 中覆盖 .gitattributes text=auto,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30978710/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com