merged-worktree-cleanup
Safe cleanup pattern for stale local worktrees after branches land in main
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Safe cleanup pattern for stale local worktrees after branches land in main
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Squad branching model: main-only workflow with feature branches
{what this skill teaches agents}
Wire legacy .NET Framework service hosts through Enterprise Library-flavored appSettings so Unity, service location, exception policies, logging, and database aliases all hang off one configuration seam.
Build internal order-management Web Forms pages with ObjectDataSource, GridView, DetailsView, and ViewState-heavy filter handling.
Build a believable mid-2000s .NET data layer around connection catalogs, stored-procedure wrappers, DataSets, and repository facades.
Anchor store-ops workbench screens in separate StoreOps tables for order state, status snapshots, workforce alerts, and zone bulletins, with dispatch tickets linked back to orders.
| name | merged-worktree-cleanup |
| description | Safe cleanup pattern for stale local worktrees after branches land in main |
| domain | version-control |
| confidence | high |
| source | extracted from Ripley cleanup session |
Use this when the repo has multiple local worktrees and you need to remove branches that have already landed in main without discarding meaningful local work.
origin/main FirstFetch with prune, compare main...origin/main, and only fast-forward local main if it has zero unique commits. Do not classify branches against a stale local main.
After local main is current, delete a worktree branch only if git merge-base --is-ancestor <branch> main succeeds. Use the same rule for standalone local branches.
If a merged worktree is dirty, inspect the status before deleting it. Force-remove only when the remaining dirt is disposable workspace noise such as bin/, obj/, or incidental local solution-file churn; otherwise keep the worktree and report the blocker.
If the remaining value is governance, policy, or documentation, recover that slice on a fresh branch from current main instead of reviving the stale implementation branch. Pair policy files with the guide/README updates that explain the same seam so the restored branch reads as one coherent change, not a grab bag.
maingit branch -d from an unrelated current branch as the only safety check