.gitattributes Generator

Line-ending normalisation, binary files, Git LFS and diff settings.

About this tool

Tick the presets you want: normalise line endings, mark binary files, track large media and model files with Git LFS, silence lock-file diffs, override GitHub language statistics, exclude development files from archives and enable language-aware diffs. Add custom lines if needed, then save the file as .gitattributes in the repo root.

What .gitattributes controls

Unlike each developer's core.autocrlf setting, .gitattributes is committed with the repository, so its rules apply to everyone. * text=auto eol=lf makes Git store text files with LF and stops mixed CRLF/LF commits on cross-platform teams. Windows scripts (.bat, .cmd, .ps1) are kept CRLF and shell scripts LF so they run on their platforms. Marking images, fonts, PDFs and archives as binary stops Git showing garbled diffs or converting their bytes. diff=python and similar drivers make diff hunk headers show the enclosing function or class. Git LFS rules (filter=lfs) keep large design files, video, audio and machine-learning models out of normal Git history, storing small pointers instead. Lock files get -diff and linguist-generated, so pull requests aren't flooded. linguist-vendored and linguist-generated correct GitHub's language bar, and export-ignore leaves tests and CI config out of git archive and release tarballs. After adding the file, run git add --renormalize . once to apply line-ending rules to existing files. Honest limits: Git LFS must be installed on every machine and hosted LFS storage has quotas. Moving existing large files into LFS needs git lfs migrate, which rewrites history. The .gitignore generator, the .editorconfig generator and the line ending converter are related.

Frequently asked questions

What does * text=auto do?

Git detects text files and normalises their line endings to LF in the repository.

How do I fix line endings in an existing repo?

Add .gitattributes, run git add --renormalize ., and commit.

How do I track files with Git LFS?

Install Git LFS (git lfs install) and add patterns like *.psd filter=lfs diff=lfs merge=lfs -text.

Is anything uploaded?

No. The file is generated in your browser and nothing is stored or sent.