dataroaring/git-cleanup

2026-06-27

Language: Unknown

Link: https://github.com/dataroaring/git-cleanup

If you've been using Git seriously for more than a year or two, you almost certainly have a graveyard of stale local branches and abandoned worktrees cluttering your repos. git-cleanup is a small utility that tackles exactly this problem: it scans your local repository for branches that have already been merged or whose upstream is gone, plus worktrees that point at deleted directories or dead refs, and helps you prune them.

The standout design choice here is the safe-by-default dry-run mode. Run it without flags and it shows you what it would delete, without actually touching anything. This is the right default for a destructive tool — it lowers the barrier to trying it out on a real repo without the anxiety of accidentally nuking a branch you forgot you needed.

Why this is interesting in a sea of similar utilities:

This will appeal to developers who juggle many feature branches, anyone running long-lived clones of monorepos, and folks who lean heavily on worktrees for review or parallel iteration (a workflow Claude Code users will recognize). It's also a tidy example for anyone writing their own Git tooling — the dry-run/apply split is a pattern worth copying.

One caveat: with zero stars and no language tag yet, you'll want to skim the source before pointing it at a repo with uncommitted work. But for a Saturday morning tidy-up of your ~/code directory, it looks like a solid little tool.

Why check it out: A focused, dry-run-first cleanup tool that finally treats stale worktrees as a first-class problem alongside dead branches.

All newsletters