원클릭으로
speckit-worktrees-clean
Remove merged, orphaned, or stale worktrees and reclaim disk space
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Remove merged, orphaned, or stale worktrees and reclaim disk space
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Generate a custom checklist for the current feature based on user requirements.
Identify underspecified areas in the current feature spec by asking up
Run a budget-aware exploration loop that externalizes every finding into the harness state files
Initialize externalized harness state (budget, candidates, curated set, evidence, verification, observations) for the active feature
Synthesize curated evidence and verification records into the feature's research.md with a coverage table
Render a compact, budget-aware slice of the harness state with a recommended next action
| name | speckit-worktrees-clean |
| description | Remove merged, orphaned, or stale worktrees and reclaim disk space |
| compatibility | Requires spec-kit project structure with .specify/ directory |
| metadata | {"author":"github-spec-kit","source":"worktrees:commands/speckit.worktrees.clean.md"} |
Remove worktrees for branches that have been merged or are no longer needed. Safely cleans up worktree directories and reclaims disk space.
$ARGUMENTS
You MUST consider the user input before proceeding (if not empty). The user may specify:
005-api-gateway) — remove that worktree onlymerged — remove all merged worktreesstale — remove stale worktrees (30+ days inactive)all — remove all worktrees (with strong warning)git worktree list — should show more than the primary checkout)Scan worktrees: List all linked worktrees and classify them:
all specifiedBuild cleanup plan: Based on user input, determine what to remove.
| User Input | Targets |
|---|---|
| Specific branch | That worktree only (with confirmation) |
merged | All merged worktrees |
stale | All stale worktrees (30+ days) |
all | Everything except the primary checkout |
| No input | Merged + orphaned only |
Present cleanup plan (always show before acting):
## Worktree Cleanup Plan
| # | Branch | Path | Status | Dirty | Action |
|---|--------|------|--------|-------|--------|
| 1 | 005-api-gateway | ../MyProject--005-api-gateway | Merged | clean | REMOVE |
| 2 | 002-old-feature | ../MyProject--002-old-feature | Orphaned | clean | REMOVE |
| 3 | 004-chat-system | ../MyProject--004-chat-system | Idle | 2 files | KEEP |
**Will remove**: 2 worktrees
**Will keep**: 1 worktree
Proceed? (confirm before executing)
Wait for user confirmation before executing any removal.
Check for uncommitted changes before each removal:
git -C <path> status --porcelainExecute cleanup for each confirmed worktree:
git worktree remove <path> (or git worktree remove --force <path> if confirmed for dirty)git worktree unlock <path> firstgit worktree prune after all removalsReport summary:
git worktree prune.worktrees/ dirs equally