Git Attributes Configuration
Recommended .gitattributes
This configuration handles line endings, binary files, and diff/merge behavior optimally:
# Auto-detect text files and normalize to LF line endings
* text=auto
# Explicitly declare binary files
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.pdf binary
*.zip binary
*.gz binary
*.bz2 binary
*.xz binary
*.tar binary
# Files that should always use LF line endings
*.sh text eol=lf
*.py text eol=lf
*.js text eol=lf
*.html text eol=lf
*.css text eol=lf
*.json text eol=lf
*.md text eol=lf
*.txt text eol=lf
# Files that should be exported-ignore by default
.gitattributes export-ignore
.gitignore export-ignore
.editorconfig export-ignore
# Custom diff/merge drivers
*.ipynb filter=nbstripout
Key Benefits
- Consistent line endings across platforms
- Proper handling of binary files
- Jupyter notebook cleaning support
- Export filtering for metadata files