Skip to content

chore: ignore extensionless build artifacts at the repo root#61

Merged
joaomdsg merged 1 commit into
mainfrom
chore/gitignore-root-binaries
May 30, 2026
Merged

chore: ignore extensionless build artifacts at the repo root#61
joaomdsg merged 1 commit into
mainfrom
chore/gitignore-root-binaries

Conversation

@joaomdsg

Copy link
Copy Markdown
Member

Compiled example programs (e.g. chat from go build ./internal/examples/chat) land at the repo root with no extension, and were one git add -A from entering history — a 15MB binary was sitting untracked at root. The hand-maintained per-name allowlist (/counter, /auth, …) had drifted and never covered chat.

Change

gitignore has no "no-extension" glob, so the rule ignores every root-level entry, then re-includes directories, any file with an extension, and LICENSE (the only extensionless tracked file). Net effect: extensionless root files (build artifacts) are ignored, everything else is tracked as normal. The drifted per-name allowlist is removed (subsumed).

Caveat documented inline: a wanted extensionless root file (e.g. Makefile) is also ignored and needs an explicit !/Makefile line. Scope is root-only — a binary built inside internal/examples/X/ isn't caught (same scope as the previous allowlist).

Verification (git check-ignore)

  • Ignored: chat, counter, coverage.out, bin, server, go.work, .claude
  • Tracked: LICENSE, app.go, go.mod, .golangci.yml, .gitignore, ci-check.sh, datastar.js, all source dirs ✓
  • Zero tracked files become ignored.

Compiled example programs (e.g. `chat` from `go build
./internal/examples/chat`) land at the repo root with no extension and
were one `git add -A` from being committed — a 15MB binary nearly
entered history. The hand-maintained per-name allowlist (/counter,
/auth, ...) had drifted and never covered `chat`.

Replace it with a general rule: ignore every root-level entry, then
re-include directories, any file with an extension, and LICENSE (the
only extensionless tracked file). Extensionless root files (build
artifacts) are now ignored; a wanted one (e.g. Makefile) needs an
explicit !/ line.
@joaomdsg
joaomdsg merged commit 81c90ba into main May 30, 2026
4 checks passed
@joaomdsg
joaomdsg deleted the chore/gitignore-root-binaries branch May 30, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant