Skip to content

Gitattributes Generator

Line endings

Binary file types

Git LFS tracking

Linguist overrides

Diff drivers

Custom rules

No custom rules. Add a pattern and its attributes.

.gitattributes
# .gitattributes
# Managed by AI Dev Hub — Gitattributes Generator

# Line-ending normalization
* text=auto
*.sh text eol=lf
*.bash text eol=lf
*.zsh text eol=lf
*.command text eol=lf
*.bat text eol=crlf
*.cmd text eol=crlf

# Binary files (no diff, no merge, no EOL conversion)
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.webp binary
*.bmp binary
*.tiff binary
*.woff binary
*.woff2 binary
*.ttf binary
*.otf binary
*.eot binary
*.zip binary
*.gz binary
*.tar binary
*.7z binary
*.rar binary

# GitHub Linguist overrides
docs/** linguist-documentation
*.min.js linguist-generated

# Diff drivers
*.md diff=markdown

What This Tool Does

Gitattributes Generator is built for deterministic developer and agent workflows.

Generate a .gitattributes file for line-ending normalization, binary files, Git LFS, and linguist overrides.

Use How to Use for execution steps and FAQ for constraints, policies, and edge cases.

Last updated:

This tool is provided as-is for convenience. Output should be verified before use in any production or critical context.

Agent Invocation

Best Path For Builders

Browser workflow

Runs instantly in the browser with private local processing and copy/export-ready output.

Browser Workflow

This tool is optimized for instant in-browser execution with local data handling. Run it here and copy/export the output directly.

/gitattributes-generator/

For automation planning, fetch the canonical contract at /api/tool/gitattributes-generator.json.

How to Use Gitattributes Generator

  1. 1

    Choose line-ending rules

    Enable `* text=auto` for cross-platform normalization, then optionally force LF for shell scripts and CRLF for Windows batch files.

  2. 2

    Mark binary and LFS files

    Tick the binary categories such as images, fonts, and archives, then select any patterns that should be tracked by Git LFS.

  3. 3

    Add linguist and diff rules

    Add linguist overrides to fix language statistics and pick diff drivers like `*.md diff=markdown` for clearer code reviews.

  4. 4

    Add custom patterns

    Use the custom rule rows to attach any pattern and attribute string your project needs, for example `*.lockb -diff -merge`.

  5. 5

    Copy or download

    Review the generated .gitattributes on the right, then copy it or download the file into the root of your repository.

Frequently Asked Questions

What is a .gitattributes file?
A .gitattributes file tells Git how to treat paths: normalize line endings, mark files binary, route them through Git LFS, or change how GitHub Linguist counts them. It lives at your repository root.
How does line-ending normalization work?
The `* text=auto` rule stores text with LF and checks it out using each platform's native endings. You can force LF for shell scripts or CRLF for Windows batch files to avoid noisy whole-file diffs.
When should I use Git LFS entries?
Track large or frequently changed binaries such as PSDs, video, and archives with `filter=lfs diff=lfs merge=lfs -text`. Git then stores a small pointer instead of the file, keeping clones fast.
What do linguist overrides change?
They adjust GitHub's language stats and diffs: mark vendored or generated paths to exclude them, flag documentation, or set linguist-language to correct a file that was detected as the wrong language.
Is the generated file private?
Yes. The .gitattributes text is assembled in your browser from the options you select. Nothing is uploaded, and you copy or download the finished file directly to your repository.