← 教程列表
news

Step 5: Cleanup (updated)

📅 2026/6/12 16:30:02⏱ 约 5 分钟阅读👁 7 阅读

``` if GIT_DIR == GIT_COMMON: # Normal repo, no worktree to clean up done if worktree path is under .worktrees/ or ~/.config/superpowers/worktrees/: # Superpowers created it — we own cleanup cd to main repo root # Bug #238 fix git worktree remove else: # Harness created it — hands off # If platform provides a workspace-exit tool, use it # Otherwise, leave the worktree in place ``` Cleanup only runs for Options 1 and 4. Options 2 and 3 always preserve the worktree. (Bug #940 fix.) **Stale worktree pruning:** After any `git worktree remove`, run `git worktree prune` as a self-healing step. Worktree directories can get deleted out-of-band (e.g., by harness cleanup, manual `rm`, or `.claude/` cleanup), leaving stale registrations that cause confusing errors. One line, prevents silent rot. (Idea from PR #1072.)

← 返回教程列表 AI8899 · 内容仅供学习参考