我有一个包含C#代码的git存储库,我在Windows上运行MSysGit
。
core.autocrlf
已启用,我正在使用this question中的.gitattributes
,并且我已经重新规范化了#34;我在this Github guide底部提到的回购。
现在对于我的存储库中 .cs 文件的部分,如果我更改了一个字符,MSysGit
认为整个文件已经更改。
我克隆了新的存储库。我尝试在Visual Studio中首先编辑该文件,但后来我尝试在SciTE中打开它,它显示了行结尾和制表符,并且我也相信它不会对文件做任何奇怪的事情(比如更改编码)
所以,我克隆了新的存储库:
$ git clone git clone git@git.assembla.com:my-repo.v2.git
$ cd my-repo/
我检查了存储库和文件:
$ git status
# On branch master
nothing to commit (working directory clean)
$ git diff path/to/myfile.cs
$
我在SciTE中打开文件(注意行结尾为CRLF
且没有标签):
using System;
using System.Collections.Generic;
...
并更改一个字符(并注意CRLF
并且没有标签仍为真):
using System;
!using System.Collections.Generic;
...
现在git认为一切都改变了:
$ git diff path/to/myfile.cs
diff --git a/path/to/myfile.cs b/Dpath/to/myfile.cs
--- a/path/to/myfile.cs
+++ b/path/to/myfile.cs
@@ -1,116 +1,116 @@
-<U+FEFF>using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Practices.EnterpriseLibrary.Data;
-using DataModel.Models;
-using DataModel.Mappers.Interfaces;
-using System.Data.Common;
-using System.Data;
...
正常的差异程序并不认为这两个文件是如此不同,而且Unix上的git diff
并不认为它们有太大的不同,但msysgit
会这样做。
以前有人遇到这个或者有任何想法吗?
答案 0 :(得分:3)
有些事情可以让Git将整个文件显示为已更改: