prune-local-branches

Installation
SKILL.md

Delete a branch only when its work is provably in the base branch, and record enough to restore anything deleted in error. A branch you cannot prove is merged stays.

Available scripts

  • scripts/classify.py — classifies every local branch against the base branch and prints the recovery record

Evidence ladder

The trap is that the obvious signals lie in the same direction — they report merged work as unmerged, so acting on them leaves the pile untouched and teaches you to force-delete instead. Trust in this order:

Signal Verdict Why
git merge-base --is-ancestor Decisive The commits are reachable from the base branch
A merged pull request for the branch Decisive Proves the work landed even when squashing rewrote it
git branch --merged Partial The ancestor test in other clothes; blind to every squash-merge
git cherry base branch Misleading A squashed commit matches no individual commit, so multi-commit branches read as unmerged while single-commit ones read as clean
An upstream marked [gone] Misleading Says the remote branch is absent, not that the work landed — and git fetch --prune can mark every branch gone at once
Diffing branch content against the base Misleading The base moves on, so differences prove nothing about what was merged
Installs
2
Repository
draekien/skills
GitHub Stars
1
First Seen
Sep 1, 2026