# Template: clean up after merge Copy, fill the `<...>` fields, and paste as the task prompt. Only run AFTER a real merge is confirmed on remote master. ```text Task: clean up branch/worktree for PR # / issue # after merge. Rules (llm-project-workflow): - Do NOT clean up until the merge is confirmed on /master. - Cleanup would-delete-unmerged-work → STOP. Never --force-remove a dirty tree. Steps: 1. git fetch --prune 2. Confirm /master contains the merge of PR # (git log /master | grep the merge, or git branch -r --contains ). If not merged → STOP; run the recovery template instead. 3. Close issue # if not auto-closed; remove the status:in-progress label. 4. scripts/worktree-clean --delete-branch /issue-- (removes branches/-issue--; refuses if dirty; git branch -d is safe-delete only — fails on unmerged.) 5. Delete the remote branch if the merge did not already remove it. 6. From the main checkout: git fetch --prune; git checkout master; git reset --hard /master ONLY if local master safely matches remote. 7. Confirm main checkout clean and current (git status; 0 0 vs /master). Handoff: merge confirmed, issue closed, branch+worktree removed, checkout clean. ```