dje*_*lin 15 git newline core.autocrlf
这是我的系统对话:
unrollme-dev-dan:views Dan$ git reset --hard HEAD
HEAD is now at 3f225e9 Fix scan titles
unrollme-dev-dan:views Dan$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: app/signup/finish.html
# modified: app/signup/scan.html
#
Run Code Online (Sandbox Code Playgroud)
我将autocrlf设置为false:
unrollme-dev-dan:unroll-website Dan$ git config core.autocrlf
unrollme-dev-dan:unroll-website Dan$
unrollme-dev-dan:unroll-website Dan$ git config --global core.autocrlf
unrollme-dev-dan:unroll-website Dan$
Run Code Online (Sandbox Code Playgroud)
而且我没有任何.gitattributes文件弄乱了这个:
unrollme-dev-dan:unroll-website Dan$ find . -name .gitattributes
[ only results are in different directory tree ]
Run Code Online (Sandbox Code Playgroud)
这是由.gitattributes一个级别引起的,如下面的答案中所指出的.
当我od -c对它显示的文件执行操作时\r\n.我不知道他们"应该"是什么,大概是他们应该结束\n,这就是差异显示的原因.但我不明白这些文件是如何在结账时修改的,即使是autocrlf假的.
除了autocrlf之外,什么可以导致git在checkout上修改文件?
Cri*_*ero 19
此问题可能是由gitattributes的文本选项https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html引起的
通过临时编辑.gitattributes项目文件夹中的文件可以解决此问题.
更改* text=auto 以#* text=auto对文件行结尾进行必要的更改并推送您的提交.然后,您可以在完成更改后再次启用它,或者选择可能更适合您项目的其他选项之一.
| 归档时间: |
|
| 查看次数: |
4605 次 |
| 最近记录: |