Skip to content
Novus Examples
gitattributes477 B

Gitattributes - End-of-Line Normalisation Rules

The attribute file that decides what happens to line endings on checkout: `text=auto` as the default, explicit `eol=lf` and `eol=crlf` overrides, the `binary` macro that expands to `-text -diff`, and one `-text` entry that is still given a textconv driver. This is the file whose absence causes the CRLF twins elsewhere in this category.

Preview — first 18 linesgitattributes
# Let git decide what is text, and store it with LF in the repository
* text=auto

# Always LF in the working tree, whatever the platform
*.sh      text eol=lf
*.py      text eol=lf

# Always CRLF in the working tree — these break otherwise
*.bat     text eol=crlf
*.sln     text eol=crlf

# Never touch these: no normalisation, no diffing as text
*.png     binary
*.pdf     binary

# Explicitly NOT text, but still diffable with a converter
*.docx    -text diff=astextplain

Specifications

Seed
20260807
Repository Name
.gitattributes
Rules
9
Eol Values
lf, crlf
Uses Text Auto
true
Uses Binary Macro
true
Line Endings
LF
Encoding
UTF-8

Testing contract

Expected to pass
Scenario
Determine the checkout line endings for a .sh, a .bat and a .png under these attributes.
Expected result
The .sh file is checked out with LF, the .bat file with CRLF, and the .png is not normalised at all; the .docx is treated as binary for storage but diffable through astextplain.

What is a .gitattributes file?

A .gitattributes file assigns per-path attributes that change how Git handles matching files. It controls end-of-line normalisation (`text`, `-text`, `eol=lf`), diff and merge drivers, export filtering, `linguist-*` language hints, and Git LFS filters, using the same pattern syntax as .gitignore with attributes listed after each pattern.

How to use this file

Use an example .gitattributes file to test attribute parsers and repository-tooling that has to honour line-ending or diff-driver rules, verifying that binary paths are excluded from text normalisation and that later patterns override earlier ones.

How to use this file for testing

“Gitattributes - End-of-Line Normalisation Rules” is a deterministic Novus Examples fixture for Config parsing, Encoding detection, Config testing. TOML and INI configuration files with nested sections and typed values — for testing config parsers and loaders.

Documented properties for this file: seed 20260807 · UTF-8 · LF. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Diff and patch fixtures name their target paths and the exact edge case they exercise — rename, mode change, binary hunk, CRLF↔LF, or missing trailing newline. Apply or render them against the documented before-state; every author, path, and hash is fictional.

Point your config loader at the file and assert it reads the documented sections and typed values, including any deliberately-tricky nesting or comments.

Generated by generation/version_control.py. Free for any use, no attribution required — license.