I do have two files in my project where git tells me I do have changes in. When I click on the changes the diff says “contents are identical”. Which makes sense because I’ve never actively touched those files.
One of the files is a “yml” file and the other one “gradlew.bat” Both files are CRLF. When I do run git add .
it gives me this error
warning: in the working copy of 'file.yml', CRLF will be replaced by LF the next time Git touches it
What I tried:
-
I tried to revert the changes but it does not work, the files are still there.
-
What I also tried was
git stash
and gitgit stash pop
afterwards. And alsogit stash apply
. Both had no impact -
I tried to delete the files manually and then pulling from the repository. Files occurred immediately in changes again.
-
I tried
git reset --hard
andgit clean -f -d
-
I tried
git rm --cached
on the files andgit rm --cached -r .
-
I tried
git update-index --refresh
-
I tried
git config --global core.autocrlf false
-
git add --renormalize
gave me even more files more yaml, bat and one java file occurred -
I committed the files and run
git reset --soft HEAD~1
-
I went to origin/main and copied the contents from the files by hand. Had no impact
-
I committed the files and pushed them to the remote repository. The changes were gone for a second but after I pulled from main they occurred again. After that we also merged this to main, then my colleague pulled it and now has the same error with the same to files, we reverted the merge. (So obviously git touched it but it had no impact)
-
Other people from the team that pulled from the repo (not my faulty merge) do not have the problem.
-
I deleted the repository and cloned it again. Files occurred immediately in changes again.
-
I uninstalled intelliJ and Git from my pc. But it did not help.
In .gitattributes those two file types are set to
*.bat text eol=crlf
*.yml text eol=lf
what could be the issue ?
Susanne is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.