As soon as I clone a certain repo on my macbook pro, I immediately see files as modified in that repo. I’ve tried git pull, git checkout, git reset, nothing seems to make these supposedly modified files go away. I’ve been using git for a while and have never seen this before. What could possibly be causing it?
Share
There is a configuration file that marks certain types of source files as text, for which newlines will be converted. There’s either a
.gitattributesfile in the root of the repository, or a global~/.gitattributesin your home directory.You can do two things:
.gitattributesconfiguration so that files aren’t marked astextanymoreI’d say that the intention was to properly let git handle newlines, so someone added the configuration in
.gitattributesafter some files were committed with the Windows CRLF endlines, and when that happens, git doesn’t automatically fix the existing files that were already checked out in the working tree. But a new clone will get those files into the working tree anew and automatically fix them, so git will complain next time you compare the working tree with the index.