/git-workflow:clean-gone [--dry-run]from git-workflow
Deletes local Git branches whose upstream was deleted on the remote (marked [gone]) and removes attached worktrees. Supports --dry-run and protects configurable branches like staging, main, master, and current branch.
Ships in git-workflow. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Cross-runtime: follow runtime compatibility for invocation, delegation, configuration precedence, state paths, and permissions.
You are cleaning up local Git branches whose remote tracking branch has been deleted (shown as [gone] by Git), along with any worktrees checked out to them. This is destructive, so it is designed to be safe by default: it never discards uncommitted work or unmerged commits without explicit, informed confirmation. Follow each step in order.
--dry-run → show exactly what would be removed and stop. In dry-run, make no changes to Git state at all (no fetch/prune, no deletion).Default (no args): proceed through confirmation (Step 4) before any deletion.
--dry-run)Only when NOT --dry-run, prune stale remote-tracking refs so [gone] is accurate:
git fetch --prune
--dry-run, do NOT run this (it mutates local refs). Use the current tracking state and note in the output that it may be stale — the user can re-run without --dry-run to refresh.fetch fails (offline, no remote), warn and continue with the current state.List local branches whose upstream is marked [gone]:
git for-each-ref --format '%(refname:short) %(upstream:track)' refs/heads \
| awk '$2 == "[gone]" { print $1 }'
Resolve the protected branches (never delete these) from .git-workflow/config.yaml, then .claude/config.yaml as a legacy read-only fallback, then defaults:
workflow.developmentBranch — default stagingworkflow.productionBranch — default maingit branch --show-current), and master.Exclude every protected branch from the deletion list even if it is marked [gone] (a gone staging/main is a config/remote quirk, not a signal to delete it).
For each candidate branch, gather safety signals to show the user:
git branch -d, which refuses unmerged branches).Present a table: branch → merged/unmerged → worktree path (clean/dirty). Then:
--dry-run: print the table and stop (no changes).A branch checked out in a linked worktree cannot be deleted until the worktree is removed. Map worktrees to branches:
git worktree list --porcelain
For each gone branch with a worktree, check for uncommitted work first:
git -C "{worktree_path}" status --porcelain --untracked-files=all
git worktree remove "{worktree_path}" (no --force needed for a clean worktree).git worktree remove --force "{worktree_path}". Otherwise skip the branch and report why.Then prune administrative leftovers: git worktree prune.
For each confirmed branch, try the safe delete first:
git branch -d "{branch_name}"
-d succeeds only if the branch is already merged (into HEAD or its upstream). This is the desired path for the common "PR merged, remote branch deleted" case.
If -d fails because the branch is not merged, the branch has local commits that exist nowhere else. Show them:
git log --oneline "{branch_name}" --not --remotes
Report these commits and ask the user for explicit confirmation before force-deleting. Only on explicit confirmation:
git branch -D "{branch_name}"
Never force-delete (-D) unmerged branches without showing the commits and getting a clear yes.
Print a summary:
Pruned gone branches:
✓ feature/eng-123-old-thing (merged; worktree removed: ../wt-eng-123)
✓ fix/proj-456-done (merged)
⚠ spike/experiment (skipped: 3 unmerged commits — not deleted)
⚠ feature/wip (skipped: worktree has uncommitted changes)
Removed: 2 branches, 1 worktree. Skipped: 2.
If nothing was gone, say so plainly: "No gone branches to clean up."
| Scenario | Action |
|---|---|
git fetch fails | Warn, continue with current tracking state |
| Branch is protected (current/dev/prod/master) | Skip it, note it is protected |
| Branch is unmerged | Skip by default; only force-delete after showing commits + explicit confirmation |
| Worktree is dirty | Skip by default; only --force remove after explicit confirmation |
| Worktree path is missing/locked | Report the error, skip that branch, continue |
git branch -d/-D fails | Report and continue with the rest |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub rlajous/claude-code-commands --plugin git-workflow22 skills in this plugin
/change-briefTurn a pull request into a concise, self-contained HTML decision brief with business logic, diagrams when useful, conditional UI/mobile screenshots, API cURL request/response evidence, risks, verification, and representative before/after code. Use when the user asks to "explain this change as HTML", "before/after html", "change brief", "html explainer for a PR", "explain what changed", or wants a shareable, human-readable snapshot of a code change. Args a PR number/URL, or nothing to use the current branch's PR./close-customer-loopClose the loop with a customer or partner after their reported bug/request ships. Use whenever a customer/partner-reported fix reaches production, a ticket that came from a customer report is about to be marked Done/closed, or you're deciding whether follow-up is still owed. Enforces verify-in-prod-then-reply-in-the-original-thread, and adds the two acceptance-criteria lines when creating customer/partner tickets./commitOther plugins' skills for the same job