Skip to content

gitbroom

Clean up stale local git branches in one command. gitbroom finds local branches that are already merged or whose upstream is gone, shows you the list grouped by reason, and deletes them only after your confirmation.

Local branches pile up. You merge a PR, the remote branch gets deleted, but the local copy lingers. Multiply that by every feature you ship and git branch becomes a graveyard. gitbroom finds the dead branches and removes them — safely, and only after you say so. The current branch and the default branch are never touched.

Terminal window
Default branch: main · current: feature-y
Merged into default branch:
✓ feature-x (merged)
✓ hotfix-123 (merged)
Upstream gone:
⚠ old-spike (upstream gone) — force delete
Delete 3 branch(es)? [y/N]

Two kinds of stale

Finds branches merged into the default branch and branches whose upstream is gone (the [origin/x: gone] marker in git branch -vv).

Never deletes your work

The current branch and the default branch are always excluded. Merged branches use the safe git branch -d, which refuses to drop unmerged work.

Force deletes are flagged

A gone-but-unmerged branch needs git branch -D. gitbroom labels it force delete in the list, so you know exactly what you’re agreeing to.

Confirm, or don't touch

Candidates are grouped and shown first; nothing is removed until you type y. Or pass --dry-run to preview and change nothing at all.

Filter what you sweep

Narrow to just --merged or just --gone, override detection with --main <branch>, or skip the prompt in scripts with -y.

Pure Node over git

No daemon, no config, no network. A thin wrapper around your local git, with the branch-selection logic in pure, well-tested functions.


MIT   github.com/abdulmunimjemal/gitbroom