.gitattributes Generator
Generate a .gitattributes that normalises line endings to LF, marks binary files, routes large media to Git LFS, improves diffs and keeps dev files out of archives.
Free · No sign-up · Your inputs stay in your browser
Input
Generate a .gitattributes file
Output
.gitattributes
792 characters
eol=lf makes line endings a property of the repository rather than of each contributor's core.autocrlf setting, which is what stops a Windows checkout from breaking shell scripts with ^M. After adding it to an existing repository, run git add --renormalize . once and commit the result. export-ignore is what keeps tests and CI files out of Composer's dist zip.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
Line endings belong to the repository
Without attributes, line-ending conversion depends on each contributor's core.autocrlf setting, and a shell script checked out on Windows can gain carriage returns that break it with bad interpreter errors. eol=lf in .gitattributes makes the rule part of the repository. After adding it, git add --renormalize . fixes files already committed. See the gitattributes documentation.
Package distributions
Composer's dist downloads and git archive respect export-ignore, so tests, CI configuration and editor files stay out of the zip that users install.