gitattribute enhance the cross-platform consistency, especially
- Line endings (LF vs CRLF)
- File types (text vs binary)
- OS-specific build artifacts It also ensure Git doesn’t corrupt the files and fine tuning for performance
# Normalize all text files (cross-platform safe)
* text=auto
# Filter Diff for Better Code Review (need to configure in .git/config as well)
*.md diff=markdown
# Scripts
*.sh text eol=lf
*.bat text eol=crlf
# Mark binary files
*.png binary
*.zip binary
*.pdf binary
# Auto-resolve conflicts in lock files generated by package managers
*.lock merge=ours
# Git LFS (Handles large files better, Git itself doesn’t scale well for big binaries)
*.psd filter=lfs diff=lfs merge=lfs -text
# Exclude from `git archive`
secrets.env export-ignore
build/ export-ignore