Git .gitattributes
.gitattributes is a file in your repository that gives settings to files by pattern, much like .gitignore lists files to ignore.
It is most often used to fix line endings for everyone on the team, to mark files as binary, and to send files to Git LFS.
A typical .gitattributes file
* text=auto
*.sh text eol=lf
*.bat text eol=crlf
*.png binary
Check which attributes a file gets
git check-attr text eol -- build.sh
build.sh: text: set
build.sh: eol: lf
git check-attr --all -- logo.png
logo.png: binary: set
logo.png: diff: unset
logo.png: merge: unset
logo.png: text: unset
Common Attributes
text=auto lets Git find text files and normalize their line endings. eol=lf or eol=crlf forces one kind of line ending in the working directory. binary turns off line ending changes and text diffs for the file.