원클릭으로
worktree-cleanup
Clean up worktrees for branches that have been merged and deleted
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Clean up worktrees for branches that have been merged and deleted
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Create and check out a feature branch when currently on master
Create a git commit with a short, lowercase commit message
Evaluate review comments from the conversation and determine which are valid
Analyze a GitHub issue and develop an implementation plan
Review unstaged git changes for bugs, logic errors, and security problems
Create a new worktree and branch from a GitHub issue
| name | worktree-cleanup |
| description | Clean up worktrees for branches that have been merged and deleted |
| disable-model-invocation | true |
The user wants to clean up worktrees that are no longer needed because their branches have been merged and deleted on GitHub.
Follow these steps:
Fetch latest from remote by running git fetch origin --prune to update remote tracking refs and prune deleted branches.
List all worktrees by running git worktree list to get all current worktrees and their branches.
Identify candidates for cleanup. For each worktree (excluding the main worktree at the repo root):
git branch -r --list "origin/<branch-name>".If no candidates are found, tell the user all worktrees are still active and there's nothing to clean up.
Present the candidates to the user. Show a summary like:
Found worktrees for branches that no longer exist on remote:
- ../ordning-72-dataset-export (branch: 72-dataset-export)
- ../ordning-85-fix-login-bug (branch: 85-fix-login-bug)
Ask the user which ones they want to remove, or if they want to remove all of them.
For each worktree the user confirms for removal:
git worktree remove <worktree-path> to remove the worktree.git worktree remove --force <worktree-path>.git branch -d <branch-name>. If it fails (not fully merged), inform the user and ask if they want to force it with git branch -D <branch-name>.Run git worktree prune to clean up any stale worktree references.
Show a summary of what was cleaned up:
Cleaned up 2 worktree(s):
- ../ordning-72-dataset-export
- ../ordning-85-fix-login-bug