Von Gast (nicht überprüft) , 29 April 2026

Das Zeilenenden-Problem

Windows verwendet CRLF, Linux und macOS verwenden LF.

Das einfache, robuste Setup

# .gitattributes
* text=auto eol=lf

*.{cmd,bat,ps1} text eol=crlf

*.png binary
*.jpg binary
*.pdf binary
*.zip binary

Wie text=auto funktioniert

Beim Commit schaut Git auf den Dateiinhalt.

Bestehende Repos renormalisieren

git add --renormalize .
git commit -m "Normalize line endings"

core.autocrlf versus .gitattributes

.gitattributes gewinnt.

Binaries markieren

*.png binary
*.jpg binary
*.gif binary
*.ico binary
*.pdf binary
*.zip binary
*.tar binary
*.gz binary
*.dll binary
*.exe binary

Per-Datei-Overrides

Makefile     text eol=lf
*.sh         text eol=lf
*.bat        text eol=crlf
*.ps1        text eol=crlf
*.csv        text

Diff- und Merge-Treiber

*.docx diff=docx
*.pdf diff=pdf
composer.lock merge=ours

Verifikation

git check-attr -a path/to/file
git ls-files --eol