Search code examples
gitgithubcommitline-endings

Why is GitHub creating nonsense commits, here?


I cloned a friend's project. I haven't done any modifications and I already have tons uncommitted changes for all project files! For each file, it's as if I simply cut and paste all the contents, but I never did this, and even if I did it, there are no changes.

I tried to sync, but the uncommitted changes stay here forever anyway, so it makes tons of conflicts because, each time I push my changes, I also change all project files.

An exemple of these nonsense commits:

- Azerty
- Hello
- Codes
+ Azerty
+ Hello
+ Codes

Git always does this to all the code in all the tracked files; even after a sync, the uncommited changes appear again.

How to fix it? Why it this happening?


Solution

  • See https://help.github.com/articles/dealing-with-line-endings/

    Mac: git config --global core.autocrlf input

    Windows: git config --global core.autocrlf true

    Linux: git config --global core.autocrlf input