🔀 The Ignore Rule That Only Ever Lived on One Machine
.git/info/exclude works exactly like a .gitignore file in every practical sense – same pattern syntax, same effect on git status and git add – with exactly one deliberate difference: it lives inside the .git directory itself rather than in the repository’s tracked working tree, specifically so its rules apply only to the one local clone they were written in and are never committed, pushed, or seen by anyone else who clones the same repository. A developer who adds a pattern there expecting it to behave like a project-wide .gitignore entry – say, to silence a personal editor’s config file or a locally generated report – gets exactly the local-only behavior the mechanism was designed for, then is confused weeks later when a teammate’s fresh clone shows that same file as untracked and cluttering git status, with no .gitignore entry anywhere in the repository history explaining why.
🔎 The Problem
$ cat .git/info/exclude # Local notes and scratch files I don't want cluttering git status *.local-notes.md /reports/draft-*.csv $ git status nothing to commit, working tree clean <- clean, on THIS machine # .git/info/exclude lives inside .git/ itself, which is never # tracked, committed, or transferred by clone/push/pull in any way - # it is pure per-clone local configuration, by design. # A teammate clones the same repository fresh: $ git status Untracked files: draft-notes.local-notes.md reports/draft-march.csv # Nothing in the committed .gitignore (if one even exists) mentions # these patterns, because they were never meant to be shared - # the teammate has no way to discover these exclusion rules exist # at all without being told directly.
✅ Fix: Use info/exclude Only for Genuinely Personal, Local-Only Rules
- Reserve .git/info/exclude strictly for patterns that are genuinely personal to one developer’s own local setup – a particular editor’s scratch files, a personally generated report format nobody else produces – and move anything that should apply consistently for every clone of the repository into the project’s tracked .gitignore file instead.
- If a rule was added to info/exclude by habit rather than deliberate choice, check whether it actually belongs in the committed .gitignore – most build artifacts, dependency folders, and generated files that any contributor’s machine would also produce are exactly the case .gitignore exists for, and info/exclude being local-only is actively the wrong behavior for them.
- Document any genuinely personal info/exclude patterns somewhere a new team member would actually see them (a CONTRIBUTING.md note mentioning the convention, for instance) if the pattern represents a recurring local-tooling artifact every new contributor is likely to hit – the mechanism’s local-only nature means the only other way teammates learn about it is by noticing the clutter themselves and asking.
🚨 Why This Is Dangerous
- There is no git command that lists or surfaces info/exclude’s rules to anyone who isn’t already looking directly inside .git/info/exclude on that exact machine – a teammate confused by untracked files has no obvious command to run that would reveal a colleague elsewhere has a local rule hiding the equivalent file on their own clone.
- Because info/exclude’s effect is completely invisible in any commit, pull request, or code review – it never appears in diffs, since .git/ itself is never tracked – two developers working on the same repository can have meaningfully different git status output for the same working tree state indefinitely, with neither having any way to notice the discrepancy from the tracked history alone.
A .gitignore rule is a decision the whole team made together, visible in history forever. The same pattern in info/exclude is a decision exactly one person made, visible to exactly that one person, forever.
