【发布时间】:2015-07-27 13:06:16
【问题描述】:
我知道有人问过类似的问题,但我仍然无法解决问题。
我的项目在使用不同操作系统的人之间共享,我在 OSX 上。此外,并不是每个人都使用 git,我有时不得不提交其他人的更改。
有时,git 突然说有待处理的更改。查看它们看起来相同的文件:
@@ -1,6 +1,6 @@
-<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
->
- <Deployment.Parts>
- </Deployment.Parts>
-</Deployment>
+<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+>
+ <Deployment.Parts>
+ </Deployment.Parts>
+</Deployment>
我怀疑这些是行尾问题。
[编辑] 一个外部 diff 工具明确表示:“状态:1 差异行尾不同 - 左:Windows (CRLF),右:Unix (LF)”
根据一些在线提示,我的配置如下:
[core]
excludesfile = /Users/nathanh/.gitignore_global
autocrlf = input
attributesfile = /Users/nathanh/.config/git/attributes
whitespace = cr-at-eol
还有我的属性文件:
# Ignore all differences in line endings
* -crlf
为什么仍然显示文件已修改?
【问题讨论】:
-
如果您未设置 core.filemode 或设置为 true,输出是否不同?您也可以尝试禁用 core.whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol;
-
问题之一是我需要做什么才能应用这些更改?
-
取消设置文件模式:尝试 git config core.fileMode false
标签: git line-endings