ワンクリックで
worktree-cleanup
Safely remove merged or obsolete git worktrees for this repository
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Safely remove merged or obsolete git worktrees for this repository
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Create a PHOTON Action Memory release branch, version bump, changelog update, tag, and GitHub Release.
Plan and run Codex issue orchestration through CommandMate and git worktrees.
Create a develop-targeted pull request for the current issue worktree.
Implement one assigned issue in a dedicated git worktree.
Generate and record UAT checks, including manual GUI or real-device steps.
| name | worktree-cleanup |
| description | Safely remove merged or obsolete git worktrees for this repository |
Safely clean up git worktrees for photon-action-memory.
Use this when the user invokes:
/worktree-cleanup <issue_number>/worktree-cleanup allThe default integration branch for this repository is develop; remote merge
checks use origin/develop.
develop.git worktree remove --force.git branch -D.origin/develop.Issue worktrees created by the Codex harness normally look like:
../photon-action-memory-issue-<number>-<slug>
Branches normally look like:
feature/issue-<number>-<slug>
Do not assume the slug. Discover candidates from git worktree list --porcelain
and match by branch name or path.
Run:
git branch --show-current
git worktree list --porcelain
git fetch origin develop --prune
If git fetch fails, continue with local information only and clearly state
that remote merge verification could not be refreshed.
For /worktree-cleanup <issue_number>:
feature/issue-<issue_number>- or
whose path contains photon-action-memory-issue-<issue_number>-.For /worktree-cleanup all:
develop worktree.feature/issue-.For each candidate, collect:
git -C <worktree_path> status --porcelain
git -C <worktree_path> branch --show-current
git merge-base --is-ancestor <branch> origin/develop
Interpretation:
status --porcelain has output: dirty, do not remove.merge-base --is-ancestor returns 0: branch is merged into origin/develop.merge-base --is-ancestor returns non-zero: unmerged, do not delete the
branch. Do not remove the worktree unless the user explicitly says it is
obsolete and accepts losing that checkout.Only for clean, merged issue worktrees:
git worktree remove <worktree_path>
git branch -d <branch>
If git branch -d reports that the branch is not found or already deleted,
record that as non-fatal. If it reports that the branch is not fully merged,
do not retry with -D.
Run:
git worktree prune
git worktree list
Report:
git worktree list summaryKeep the final response concise:
Removed:
- <path> (<branch>)
Skipped:
- <path> (<branch>): <reason>
Verification:
- git worktree prune: completed
- git worktree list: <remaining count or summary>