branch-hygienelisted
Install: claude install-skill damson/hard-won-skills
# Post-merge branch hygiene
After any merge to `develop` / `main`, the other open PRs that branched from the merged work appear `CONFLICTING` on GitHub because the merge commit assigned new SHAs to commits whose patches are now in the base. Resolution is mechanical: rebase + force-push.
## Before you merge a PR others are based on
Merging is where a stack is lost, and both failure modes look like the tool
helping.
1. **Find the children, and retarget them FIRST**:
```bash
gh pr list --base <branch-about-to-merge> --json number,headRefName
gh pr edit <n> --base <the parent's own base> # BEFORE the merge
```
Merging the parent does **not** retarget a child — it leaves it running its
checks against a branch nobody will push to again. Deleting the parent's
branch does not retarget it either: it **closes** it. And a closed PR can be
neither retargeted (`Cannot change the base branch of a closed pull request`)
nor reopened once its base branch is gone, so the only recovery is a new PR
from the same branch — the review history stays behind on the closed one.
2. **Remove the worktree holding the branch**, or `--delete-branch` fails with
`cannot delete branch '<x>' used by worktree at …` and the merge lands with
the branch still there — which is the state that leaves a child stranded.
```bash
git worktree remove <path> && gh pr merge <parent> --squash --delete-branch
```
3. **Then rebase each child** onto the new base, per the