Help us improve
Share bugs, ideas, or general feedback.
npx claudepluginhub objectiveous/dots-claude-plugins --plugin dots-devHow this command is triggered — by the user, by Claude, or both
Slash command
/dots-dev:worktree-cleanupThis command is limited to the following tools:
The summary Claude sees in its command listing — used to decide when to auto-load this command
# Cleanup Stale Worktrees
Removes worktrees that no longer exist from the registry, prunes git worktree metadata, and optionally removes merged branches.
**Usage:** `/dots-dev:worktree-cleanup [--prune-merged]`
## Context
- Existing worktrees: !`git worktree list`
- Registry file: !`cat ~/.claude/worktree-registry.json 2>/dev/null || echo "{}"`
## Your task
Clean up stale worktrees and registry entries.
**Required steps:**
1. **Prune git worktree metadata**: Run `git worktree prune -v` to remove references to deleted worktrees.
2. **Clean registry entries**: Check `~/.claude/worktr.../worktree-cleanCleans finished git worktrees by removing directories for safe (merged, no uncommitted changes) ones, pruning references, and reporting removed/kept items.
/worktree-cleanupCleans up merged and stale git worktrees by invoking git-worktree skill and running worktree-manager.sh cleanup, then reports what was removed.
/cleanup-worktreesRemoves safe git worktrees for merged branches only (checked via git branch --merged and gh PRs), cleans orphans, categorizes kept ones, and generates a cleanup report.
/cleanupRemoves already merged Git worktrees and their branches. Supports --dry-run to preview candidates and confirmation before deletion.
/clean-worktreesSafely removes specified git worktrees using `git worktree remove` without --force, relying on git's safety checks for clean state and pushed commits.
/clean_goneCleans up local Git branches marked [gone] (deleted on remote) by removing associated worktrees and deleting branches. Lists branches/worktrees first and reports results.
Share bugs, ideas, or general feedback.
Removes worktrees that no longer exist from the registry, prunes git worktree metadata, and optionally removes merged branches.
Usage: /dots-dev:worktree-cleanup [--prune-merged]
git worktree listcat ~/.claude/worktree-registry.json 2>/dev/null || echo "{}"Clean up stale worktrees and registry entries.
Required steps:
Prune git worktree metadata: Run git worktree prune -v to remove references to deleted worktrees.
Clean registry entries: Check ~/.claude/worktree-registry.json for entries pointing to non-existent paths. Remove stale entries using:
jq --arg path "<stale-path>" 'del(.[$path])' ~/.claude/worktree-registry.json > ~/.claude/worktree-registry.json.tmp && mv ~/.claude/worktree-registry.json.tmp ~/.claude/worktree-registry.json
If --prune-merged flag is provided: Find worktrees whose branches have been merged to main (git branch --merged main) and delete them along with their branches.
Show results: Display git worktree list to show remaining worktrees.