I am on Windows and disabled core.autocrlf :
$ git config core.autocrlf; git config --global core.autocrlf false false
Now, I would suggest that git does not interfere with any line endings, but some files in my repository continue to cause problems.
I just cloned a new copy of the repo, and git already tells me that there are unspecified changes. When I git diff -R , I see that the CRLF line ending has been added to the file:
diff
I donโt understand where these lines come from, but I also cannot โreturnโ this change. When I exit the file again, it will still change after:
$ git checkout -f nginx-1.11.1/contrib/geo2nginx.pl $ git status On branch dev Your branch is up-to-date with 'origin/dev'. 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: nginx-1.11.1/contrib/geo2nginx.pl no changes added to commit (use "git add" and/or "git commit -a")
This makes no sense to me, so I just ran dos2unix in the file:
$ dos2unix nginx-1.11.1/contrib/geo2nginx.pl dos2unix: converting file nginx-1.11.1/contrib/geo2nginx.pl to Unix format...
Now there should be no change, right? But the file is still showing as changed in git status , and git diff will still report the completion of the CRLF line in the working copy.
When I execute and commit the file now, the resulting file will have an LF line ending, although diff showed CRLF line endings.
I don't have a global .gitattributes ( git config --global core.attributesfile doesn't output anything). And .gitattributes in the project has * text eol=lf set ( full .gitattributes ).
What is going on here and how can I solve it?
Reproduce the problem
I can reproduce this problem with an open source project that I support :
$ git clone git@github.com :fairmanager/fm-log.git Cloning into 'fm-log'... remote: Counting objects: 790, done. remote: Total 790 (delta 0), reused 0 (delta 0), pack-reused 790 Receiving objects: 100% (790/790), 201.71 KiB | 138.00 KiB/s, done. Resolving deltas: 100% (418/418), done. Checking connectivity... done. $ cd fm-log/ $ git status On branch master Your branch is up-to-date with 'origin/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: .idea/dictionaries/OliverSalzburg.xml modified: .idea/inspectionProfiles/Project_Default.xml modified: .idea/inspectionProfiles/profiles_settings.xml no changes added to commit (use "git add" and/or "git commit -a")