From git-clean-gone
Clean up local branches with deleted remote tracking and their worktrees. Use after merging PRs to remove stale branches, detect squash-merged and rebased branches, and clean up associated worktrees.
How this skill is triggered — by the user, by Claude, or both
Slash command
/git-clean-gone:git-clean-goneThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Delete local branches whose remote tracking is gone or merged, and remove their associated worktrees.
Delete local branches whose remote tracking is gone or merged, and remove their associated worktrees.
Parse from $ARGUMENTS:
| Flag | Default | Purpose |
|---|---|---|
| (none) | — | Full cleanup: gone + merged branches + worktrees |
--dry-run | off | Preview only, no changes |
--no-worktrees | off | Branches only, skip worktree removal |
git for-each-ref --format="%(upstream:remotename)" refs/heads/main 2>/dev/null || git remote | head -1 2>/dev/null || echo "origin"basename "$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null || echo refs/remotes/origin/main)"command -v gh >/dev/null 2>&1 && echo "available" || echo "unavailable""${CLAUDE_SKILL_DIR}/scripts/clean-gone.sh" as a single Bash invocationExecute "${CLAUDE_SKILL_DIR}/scripts/clean-gone.sh" immediately, passing through any flags from $ARGUMENTS.
--dry-run → preview only, no changes--no-worktrees → gone branches only, no worktree removal or merge detection--dry-run, --no-worktrees), stopParse script output line prefixes and render formatted summary directly as text.
Line prefixes (from script output):
| Prefix | Meaning |
|---|---|
DELETED:branch:reason | Deleted branch |
REMOVED_WT:worktree:branch | Removed worktree |
SKIPPED:branch:reason | Skipped branch |
KEPT:branch:reason | Kept branch |
KEPT_WT:worktree:branch:reason | Kept worktree |
Dry-run uses WOULD_DELETE, WOULD_REMOVE_WT, WOULD_SKIP, WOULD_KEEP, WOULD_KEEP_WT.
Summary format:
**Cleanup Summary**
Deleted:
🗑️ fix/old-feature (gone)
🗂️ fix-old-feature-wt (worktree)
Skipped:
⚠️ feat/current-work (current branch)
Kept:
🗂️ wt-name (worktree) - branch (N unmerged)
ℹ️ feat/in-progress (14 unmerged)
Only include sections with items. Empty state: ✅ Repository already clean — no branches to process
Dry-run header: **Dry Run Preview** with "Would delete/remove" phrasing.
[gone] (remote tracking deleted)git cherry)gh pr list --state merged) when gh CLI is available--force flaggh CLI (see preprocessed context): squash merges won't be detected, only git cherry used/git-clean-gone
Preview what would be deleted:
/git-clean-gone --dry-run
Branches only, no worktree removal:
/git-clean-gone --no-worktrees
npx claudepluginhub smykla-skalski/sai --plugin git-clean-goneDeletes local Git branches with gone remote tracking after confirmation, including worktrees. Run discovery script, list branches, confirm y/n, then prune.
Analyzes and safely cleans up local git branches and worktrees, categorizing them as merged, squash-merged, superseded, or active work before deletion.
Safely analyzes and cleans up local git branches/worktrees: categorizes merged/squash-merged/superseded/active, groups related ones, deletes only after user approval.