Software IT-Consulting und Coaching

Resolved: Git line-endings

Usually, most cross-platform or cross-IDE projects have issues with line-endings. If some of the project’s contributor or developer does not set the property core.autocrlf=true (Windows) or core.autocrlf=input (Linux) the repository gets disrupted.

Especially the Eclipse EGit integration uses core.autocrlf=false by default, which causes issues very fast during merging processes.

To solve this problem and to be independent of the contributor’s configuration use the .gitattributes file in your base directory of the project.
It’s even possible to fix a disruptive repository with the following command stack given by Git documentation:

$ echo "* text=auto" >.gitattributes
$ git read-tree --empty # Clean index, force re-scan of working directory
$ git add .
$ git status # Show files that will be normalized
$ git commit -m "Introduce end-of-line normalization"