AI Weekly Malaysia

Back to items Summaries

.gitignore Everything by Default

ID
22045
Status
summarized
Published
05 Sep 2026, 9:19 PM
Fetched
07 Sep 2026, 10:08 AM
Provider
Hacker News
Category
dev-community
Original URL
https://packagemain.tech/p/gitignore-everything-by-default
Source URL
https://hnrss.org/best

Summary

Score
6.5
Created
07 Sep 2026, 10:11 AM
Tags
Audience
developersvibe_coders

What happened

Alex Pliutau proposes flipping .gitignore convention: ignore everything by default with `*`, then explicitly un-ignore only the files you want tracked (e.g., `!*.go`, `!go.mod`, `!README.md`). This prevents accidental commits of junk like .DS_Store, node_modules, IDE configs, and agent-generated files such as CLAUDE.md.

Why it matters

If you work in repos where AI agents and local tooling generate stray files (CLAUDE.md, subfolders, configs), a default-deny .gitignore eliminates the cleanup-and-rewrite-history dance. Try it on a small Go or similar project, and use `git check-ignore -v <path>` to debug why a file isn't tracked.

Discussion angle

Is default-deny .gitignore worth the friction for teams, or only practical for solo/small repos where you control the full file list? Compare against the 207-line .gitignore in typescript-go as a cautionary tale.

Top