I am working on a project on two different Windows systems.
If I keep working on one system, git diff
will correctly show the differences to the last commit. I commit my changes and push them to github.
But as soon as I want to continue on the other system, after a git pull origin main
from github, and changing the code, git diff
shows additional CR characters for line endings that I cannot explain other than it seems to happen only when github is involved
.
The core.autocrlf
config settings are false on both systems for the project, the user, and the system config. I use Visual Studio Code on both ends and the CRLF settings are equal in both editors.
What can I do to stop the erroneous behavior of git diff
in this situation?
The comment regarding .gitattributes
was worth its weight in gold 🙂
I added the following to .gitattributes
, committed it, pushed it, pulled it on the other side … and now both sides no longer show weird git diff
output
* text=auto
*.js text eol=crlf
How about using a
.gitattributes
file: docs.github.com/en/get-started/getting-started-with-git/…