Skip to content
shellhacks.dev
Git

.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.

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.

Share

Frequently asked questions

What does text=auto do?
Git decides per file whether it is text, normalises text files to LF in the repository and leaves binary files alone.
Why mark lock files linguist-generated?
GitHub collapses them in pull request diffs and leaves them out of the repository's language statistics.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Go deeper

Suggested reading

Keep planning

Similar tools