17

これが私のシステムダイアログです:

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
#

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$

そして、これを台無しにする .gitattributes ファイルはありません。

unrollme-dev-dan:unroll-website Dan$ find . -name .gitattributes
[ only results are in different directory tree ]

これは、.gitattributes以下の回答で指摘されているように、1 レベル上にあることが原因です。

od -cファイルに対して実行すると、 が表示されます\r\n。それらが「あるべき」ものかどうかはわかりません。おそらく、それらは終了する必要が\nあり、それが差分が表示されている理由です。しかし、私が理解していないのは、これらのファイルがautocrlffalse でもチェックアウト時に変更される可能性があるということです。

autocrlf以外に、チェックアウト時にgitがファイルを変更する原因は何ですか?

4

2 に答える 2

20

This problem can be caused by gitattributes' text option https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

This problem can be fixed by temporarily editing your .gitattributes file within your project folder.

change * text=auto to #* text=auto make the necessary changes to files line endings and push your commit. You can then enable it again after the change has been made, or alternatively select one of the other options that may better suit your project.

于 2013-03-28T16:52:23.063 に答える