Here is my system dialogue:
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
#
I have autocrlf set to 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$
And I don't have any .gitattributes files messing this up:
unrollme-dev-dan:unroll-website Dan$ find . -name .gitattributes
[ only results are in different directory tree ]
This is caused by a .gitattributes
one level up as pointed out in answer below.
When I do an od -c
on the files it shows \r\n
. I don't know what they "should" be, presumably, they should end in \n
and that is why the diff is showing. But what I don't understand is how these files could possibly be modified on checkout even with autocrlf
false.
What can cause git modifying a file on checkout besides autocrlf?
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.