← ClaudeAtlas

wt-closelisted

Finish work in a worktree — push, remove the worktree, and optionally delete the branch. Use this when the user is done with a worktree, wants to clean up, push and move on, or mentions they no longer need a parallel environment. Also triggers for `/wt-close [branch] [--push] [--force]`.
ThinkVelta/agent-tracker · ★ 1 · AI & Automation · score 71
Install: claude install-skill ThinkVelta/agent-tracker
# Worktree Close Finish work in a worktree: check for unsaved work, optionally push, remove the worktree, and let the user decide what happens to the branch. **User input:** $ARGUMENTS ## Step 1 — Identify the worktree to close **Priority order:** 1. If `$ARGUMENTS` contains a branch name or worktree path, use that. 2. If the current directory is inside a worktree (not the main working tree), use the current worktree. 3. If neither, list worktrees with `git worktree list` and ask the user to pick one. Parse `git worktree list --porcelain` to find the worktree path and branch. Identify the main working tree (the first entry) — it cannot be closed. ## Step 2 — Check for uncommitted changes ```bash git -C "<worktree-path>" status --porcelain ``` **If clean** (empty output): proceed to Step 3. **If dirty** (uncommitted changes): Show the user what's pending: ```bash git -C "<worktree-path>" status --short ``` Then present options: 1. **Commit first** (recommended) — commit in the worktree, then re-run `/wt-close` 2. **Discard changes** — proceed with force removal (requires explicit confirmation) 3. **Abort** — cancel the close operation If `--force` was in `$ARGUMENTS`, skip this prompt and proceed with force removal. ## Step 3 — Push if requested If `--push` was in `$ARGUMENTS`, or the user mentioned pushing: ```bash git -C "<worktree-path>" push -u origin "<branch>" ``` The branch must be named explicitly: agents in this repo only push explicit feature-br