Help us improve
Share bugs, ideas, or general feedback.
From go-workflow
Batch removes git worktrees for closed GitHub issues and merged branches. Checks status via gh CLI, reports summary, confirms before pruning and branch deletion.
npx claudepluginhub gopherguides/gopher-ai --plugin go-workflowHow this skill is triggered — by the user, by Claude, or both
Slash command
/go-workflow:prune-worktreeThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Batch cleanup of all git worktrees for issues that are closed and branches that are merged.
Interactively selects and safely removes a specific git worktree for issues, checking if linked issue is closed, branch merged into default, and no uncommitted changes before removal, with optional branch deletion.
Safely deletes merged Git worktrees after verifying git merge status and GitHub PR closure via gh CLI. Handles single branch or 'all' for batch cleanup post-PR merge.
Manages git worktrees for isolated parallel development: creates GitHub issue-tied branches via /pds:worktree command, lists worktrees, removes directories, prunes stale refs.
Share bugs, ideas, or general feedback.
Batch cleanup of all git worktrees for issues that are closed and branches that are merged.
$prune-worktree
git worktree list | grep "issue-" || echo "No issue worktrees found"
If no issue worktrees found, inform the user and stop.
DEFAULT_BRANCH=$(git remote show origin | grep 'HEAD branch' | sed 's/.*: //')
git fetch origin "$DEFAULT_BRANCH"
For each issue worktree:
Extract the issue number from the path:
ISSUE_NUM=$(echo "$WORKTREE_PATH" | grep -oE 'issue-([0-9]+)' | grep -oE '[0-9]+')
Check if the issue is closed:
STATE=$(gh issue view "$ISSUE_NUM" --json state --jq '.state' 2>/dev/null)
Check if the branch is merged:
BRANCH=$(cd "$WORKTREE_PATH" && git branch --show-current)
MERGED=$(git branch -r --merged "origin/$DEFAULT_BRANCH" | grep -q "origin/$BRANCH" && echo "true" || echo "false")
Classify as:
STATE = CLOSED) AND branch is merged (MERGED = true)Display a summary:
Ask the user to confirm before removing any worktrees.
For each confirmed worktree:
git worktree remove "$WORKTREE_PATH"
git branch -D "$BRANCH" 2>/dev/null || true
git worktree prune
Report what was removed and what remains.