推送提交到 github 后,代码更改显示错误

After pushing commit to github, code changes showing wrong

问题: 这是真正的 Code Difference & 在我提交的 github 中显示 @@ -1,202 +1,251 @@ 因为这个文件已被完全替换.我想看看 github.

中的代码差异,如下图所示

系统信息: 我正在使用 sublime text 2 在 windows 8.1 和使用 phpdesigner 7

在 windows 7 中编辑我的代码

解决方法,提交前试过:

我的 .git 属性:

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

# Custom for Visual Studio
*.cs     diff=csharp

# Standard to msysgit
*.doc    diff=astextplain
*.DOC    diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot  diff=astextplain
*.DOT  diff=astextplain
*.pdf  diff=astextplain
*.PDF    diff=astextplain
*.rtf    diff=astextplain
*.RTF    diff=astextplain

谢谢。

问题已解决

我做错了什么

  • 我运行unix2dos不在递归模式。
  • 我不知道为什么,但我的 .gitattribute 文件是原因之一

解决方案

  • 运行 find . -type f -exec unix2dos {} \; 这将自动将所有文件更改为 crlf/windows 格式
  • 删除了我的 .gitattributes 文件

还有 TADA,一切正常