A terminal printing a .gitattributes file, above the post title

The Best Git Feature You've Never Used

Every repo has a .gitignore. Almost nobody has a .gitattributes. That’s a shame, because this one small file controls how Git sees, diffs, merges, normalizes, and exports your files. Once you know what it can do, you’ll want one in every project. What it is .gitattributes is a plain text file that assigns attributes to paths. Each line is a pattern followed by one or more attributes: *.sh text eol=lf *.png binary docs/** linguist-documentation The patterns work much like .gitignore, with two catches. Negation (!pattern) isn’t allowed. And a directory pattern like vendor/ does not apply to the files inside it, so you need vendor/**. ...

September 24, 2026 · 7 min · Londopy