I checked out the repository, switched to the remote branch, so now I'm on detached HEAD. I haven't made any changes to the files, however, when I type git status
it shows several files with changes. There are no intricate mechanisms which might cause the files to change. The changes are like this:
File status:
-- class Foo {
-- int x;
-- int y;
-- };
++ class Foo {
++ int x;
++ int y;
++ };
I know, this kind of behaviour shows up when you mess with line endings. However, both versions of the file have identical line endings. So there is really NO changes at all.
Even if I discard the changes and check the status, the files show up as changed again.
The solution Why does git think each line of an untouched file has changed is dangerous and misleading. I do care about line endings. I have .gitattributes file describing each file type and corresponding line ending. I also renormalized repository according to GitHub's recommendations. Still, when I do checkout, this problem persists. The workaround is make useless commit and switch back to my branch, however it is hacky and not robust enough for me.
My .gitattributes file content:
*.cs text eol=crlf
*.txt text eol=crlf
*.prefab text eol=lf
*.unity text eol=lf
*.meta text eol=lf
*.png binary
*.jpg binary
*.psd binary
*.dll binary