choruz-merging-stacked-prs
Skill1.1k starsChanged 20 days agoApache-2.0View on GitHub
Use when landing a chain of dependent pull requests (A ← B ← C, each based on the one below) onto main, merging a PR whose base is another open PR's branch, or whenever a request mentions "stacked PRs", "PR stack", "dependent PRs", or merging several related PRs in sequence.
In this repository14 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .agents/notes/implemented/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- choruz-archive-agent-notesSkill
- choruz-ci-test-reliabilitySkill
- choruz-code-reviewSkill
- choruz-docSkill
- choruz-find-simplificationsSkill
- choruz-pre-push-checksSkill
- choruz-pre-simplify-auditSkill
- choruz-prose-standardSkill
- choruz-prSkill
- choruz-record-demoSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 44
Wait for every selected PR to report MERGED:
- Very specific: line 50
Delete branches only in a final pass after the corresponding PRs report MERGED and no open PR still uses the branch as a base:
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Landing a Choruz PR stack
A stack is a chain of pull requests where each upper PR's base is the head branch of the one below. Land it bottom-up, one green squash at a time, and let CI re-run against main before every merge. Never reproduce a stack by rewriting someone else's branch.
Establish the chain
Fetch current metadata for every PR rather than trusting branch names or an earlier report:
gh pr view <pr> --json number,author,baseRefName,headRefName,headRefOid,state,isDraft,mergeStateStatus,statusCheckRollupThe bottom PR targets main; each higher PR targets the head branch immediately below. Any other shape (two PRs targeting the same branch, a cycle, a cross-fork head) needs the user's direction before any mutation. If GitHub's native stack feature (gh stack) is available and the chain is already linked, prefer gh stack merge for the whole range and skip to Verify the landed state; otherwise follow the manual sequence below.
Land one layer
For the bottom PR:
- Require it open, non-draft, and
CI (linux) requiredgreen on its exact current head. A green upper layer proves nothing about its dependencies. - Squash-merge it (the repository convention). Do not delete the branch yet: the next layer still bases on it.
For the next PR up:
- Retarget its base to
main:gh pr edit <pr> --base main. - Bring
mainin. Its branch already contains the lower branch's commits, andmainnow contains their squash; a merge resolves cleanly when nothing else touched the same lines:git merge --no-edit origin/main, then push. On a branch you created, a rebase is equally acceptable; on someone else's branch, only a merge commit. - The push re-triggers CI against the real base. Wait for
CI (linux) requiredon the new head, then squash-merge.
Repeat until the requested range has landed. "Land the stack" means every layer; a partial landing names an explicit boundary PR and stops there.
Do not
- Merge an upper layer before its base has merged, or while its base is still another PR's branch.
- Force-push, rebase, or amend a branch you did not create.
- Push an empty commit or close and reopen a PR to re-run CI; a base change plus
git merge origin/mainis the correct trigger. - Bypass a red or missing
CI (linux) requiredon any layer.
Verify the landed state
Wait for every selected PR to report MERGED:
gh pr view <pr> --json number,state,mergedAt,mergeCommit,baseRefName,headRefNameDelete branches only in a final pass after the corresponding PRs report MERGED and no open PR still uses the branch as a base:
gh pr list --state open --base <branch> --json number --jq length # must print 0Checklist
- Live PR bases and heads establish one bottom-to-top chain.
- Each layer merged only when green on its exact head, bottom first.
- Each upper layer retargeted to
mainand refreshed withmainbefore its own CI run. - No branch rewritten that someone else created.
- Every selected PR reports
MERGED; branches deleted only after zero-dependent verification.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

