Zero Signup ToolsFree browser tools

Developer Tools

Gitattributes Generator

Generate a .gitattributes file. Normalize CRLF and LF line endings, mark binary files, track large files with Git LFS, and tune GitHub linguist stats.

Gitattributes generator

Quick presets

Start from a project type

Line endings

Default line-ending strategy

This sets the first line of the file, which is the default for every file Git treats as text. The most common fix .gitattributes solves is a repo where some files were committed with CRLF and others with LF.

Line-ending strategy

Rules

Pick the rules your repo needs

5 of 20 blocks selected

Line endings

Force specific endings on files that must keep LF or CRLF regardless of the repo default.

Binary files

Mark common binary types so Git never tries to normalize line endings or show a text diff.

Git LFS

Track large binary files with Git Large File Storage instead of committing them directly.

GitHub linguist

Adjust the language stats and diff behavior GitHub shows for generated, vendored, or documentation files.

Diff and merge

Nicer diffs for known formats and safer merges for lockfiles.

Archive export

Leave development-only files out of git archive tarballs and GitHub release zips.

Custom rules

Project-specific lines

Add any patterns specific to your project. One per line, in standard pattern attribute form, for example *.lockb binary or src/generated/** linguist-generated=true.

Output options

How the file is formatted

Output

Your .gitattributes

71 lines, 37 rules, default * text=auto eol=lf

# Generated with Zero Signup Tools (zerosignuptools)
# https://zerosignuptools.com/tools/gitattributes-generator
# Edit freely. Add or remove rules to suit the project.

# ============================================================
# Default behaviour
# Normalize line endings for every file Git decides is text.
# ============================================================
* text=auto eol=lf

# ============================================================
# Force LF on scripts
# Shell scripts and similar files break with CRLF. Pin them to LF.
# ============================================================
*.sh    text eol=lf
*.bash  text eol=lf
*.zsh   text eol=lf
*.fish  text eol=lf
*.bats  text eol=lf
Dockerfile text eol=lf
.gitattributes text eol=lf
.gitignore     text eol=lf

# ============================================================
# Images
# PNG, JPEG, GIF, WebP, AVIF, ICO, and friends.
# ============================================================
*.png  binary
*.jpg  binary
*.jpeg binary
*.gif  binary
*.webp binary
*.avif binary
*.bmp  binary
*.tif  binary
*.tiff binary
*.ico  binary
*.heic binary

# ============================================================
# Fonts
# WOFF, WOFF2, TTF, OTF, EOT.
# ============================================================
*.woff  binary
*.woff2 binary
*.ttf   binary
*.otf   binary
*.eot   binary

# ============================================================
# Hide generated files
# Collapse generated files in diffs and drop them from language stats.
# ============================================================
# Mark generated output so GitHub collapses it in diffs and ignores it in stats.
dist/**        linguist-generated=true
build/**       linguist-generated=true
*.min.js       linguist-generated=true
*.min.css      linguist-generated=true
*.map          linguist-generated=true
package-lock.json   linguist-generated=true
yarn.lock           linguist-generated=true
pnpm-lock.yaml      linguist-generated=true
composer.lock       linguist-generated=true

# ============================================================
# Lockfile merge strategy
# Treat lockfiles as binary during merges so Git does not produce a broken hand-merged file.
# ============================================================
Cargo.lock        merge=binary
poetry.lock       merge=binary
Gemfile.lock      merge=binary

.gitattributes syntax cheat sheet

  • pattern attr: a file pattern followed by one or more attributes.
  • * text=auto: let Git decide which files are text and normalize their endings.
  • *.sh text eol=lf: force a specific ending on a file type.
  • *.png binary: shortcut for -text -diff, so Git never alters or text-diffs the file.
  • *.psd filter=lfs diff=lfs merge=lfs -text: the standard Git LFS tracking line.
  • dist/** linguist-generated=true: collapse files in GitHub diffs and drop them from language stats.
  • tests/ export-ignore: leave a path out of git archive and GitHub source downloads.

Things to remember

  • Commit .gitattributes at the repo root so every contributor and CI runner applies the same rules.
  • Changing the line-ending rule does not rewrite files already committed. Run git add --renormalize . once, then commit, to apply it to existing files.
  • The last matching line wins for a given attribute, so place more specific patterns after broader ones if you keep both.
  • For Git LFS, run git lfs install and commit the .gitattributes file before you add the large files it should track.

How to use

  1. Pick a quick preset (web app, cross-platform team, Git LFS media repo, game or 3D project, data or ML repo, or open-source library) to seed sensible defaults, or start from scratch.
  2. Choose a default line-ending strategy. Normalize to LF is recommended for cross-platform teams and CI; the code box next to each option shows the exact line it adds.
  3. Select the rule blocks your repo needs from Line endings, Binary files, Git LFS, GitHub linguist, Diff and merge, and Archive export. Use the search box to filter.
  4. Add any project-specific patterns in Custom rules using standard pattern attribute syntax, for example *.lockb binary.
  5. Toggle Output options for the header banner, section headers, and deduplication by pattern, then click Copy or Download .gitattributes to save the file at your repo root.

About this tool

Gitattributes Generator builds a clean .gitattributes file for any repository in the browser. A .gitattributes file tells Git how to treat specific paths: how to normalize line endings, which files are binary, which files to hand to Git LFS, how GitHub linguist should count them, and what to leave out of release archives. This tool turns those decisions into a few clicks. Start with the default line-ending strategy, the single most common reason teams reach for .gitattributes. Pick text=auto with eol=lf to store and check out LF everywhere (the most predictable choice for mixed Windows, macOS, and Linux teams and for CI), eol=crlf to keep CRLF working copies, plain text=auto to normalize on commit only, or no default at all. Below the default you choose from curated building blocks grouped into line endings (force LF on shell scripts, force CRLF on batch and PowerShell files), binary files (images, fonts, audio and video, archives, documents, compiled artifacts), Git LFS tracking (images, media, archives, 3D and game assets, datasets and model weights, design files), GitHub linguist hints (mark generated, vendored, or documentation paths), diff and merge helpers (built-in language diff drivers and a safe binary merge strategy for lockfiles), and archive export rules (keep CI config, tests, and dev files out of git archive tarballs and GitHub source zips). Quick presets seed sensible combinations in one click for a web app, a cross-platform team, a Git LFS media repo, a game or 3D project, a data or ML repo, and an open-source library. Every rule is a real, widely used .gitattributes pattern, never invented. Section headers label each block so the file stays readable, and an optional deduplication pass keeps a single rule per pattern when a plain-binary block and an LFS block both mention the same extension. A custom rules box accepts any project-specific lines in standard pattern attribute form. The output panel shows the full file with live line and rule counts plus copy and download buttons, and a reminder appears when the file uses Git LFS so you do not forget to run git lfs install and renormalize. Everything runs locally in your browser, so your selections and custom rules never leave your device. Useful for fixing a repo where line endings drifted between contributors, setting up Git LFS on a media-heavy project, cleaning up the language breakdown GitHub shows, or trimming what ends up in a release tarball.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools