推送提交到 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 中编辑我的代码
解决方法,提交前试过:
- 将我的编辑器中的行格式设置更改为 windows/unix/macOSx
- 在我的 .gitattribute 添加了
* text=auto
- 我也试过
dos2unix
& unix2dos
命令
- 奇怪的是,如果我使用 vi 进行编辑,它就可以工作。但是,我不太习惯使用它。
我的 .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,一切正常
问题: 这是真正的 Code Difference & 在我提交的 github 中显示 @@ -1,202 +1,251 @@
因为这个文件已被完全替换.我想看看 github.
系统信息: 我正在使用 sublime text 2 在 windows 8.1 和使用 phpdesigner 7
在 windows 7 中编辑我的代码解决方法,提交前试过:
- 将我的编辑器中的行格式设置更改为 windows/unix/macOSx
- 在我的 .gitattribute 添加了
* text=auto
- 我也试过
dos2unix
&unix2dos
命令 - 奇怪的是,如果我使用 vi 进行编辑,它就可以工作。但是,我不太习惯使用它。
我的 .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,一切正常