stacked-pr-squash-merge
Skill4 starsChanged 16 days agoBSD-3-ClauseView on GitHub
Safely merging stacked or dependent pull requests. Read BEFORE squash-merging any PR when another open PR is based on its branch, or when merging several related PRs in sequence. Squash-merging a base PR and deleting its branch can auto-close the dependent PR, balloon its diff, or silently drop commits. Use whenever you run `gh pr merge`/`--delete-branch` on more than one related PR, or after pushing a late commit to an already-open PR.
In this repository18 other files it gives its agents.
- boettiger-lab-stackSkill
- cng-datasetsSkill
- disclose-tool-useSkill
- duckdb-spatialSkill
- gdal-spatialSkill
- github-app-authSkill
- github-rulesetsSkill
- html-figuresSkill
- human-communication-consentSkill
- k8s-never-force-deleteSkill
- nrp-kubernetesSkill
- nrp-s3Skill
- oci-artifactsSkill
- pod-resourcesSkill
- python-envSkill
- reproducible-reportsSkill
- stac-navigationSkill
- writing-voiceSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
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 17
The bite: when PR-B's base branch is PR-A's head branch (a *stacked* PR), or when you push a late commit to an open PR right before …
- Distinctive: line 35
If PRs are stacked, merge bottom-up, one at a time: Before merging or deleting the base (PR-A), retarget the dependent PR to main first:
- Very specific: line 43
Fold late edits into one commit: If you push a new commit to an already-open PR just before merging, either squash locally first or …
- Distinctive: line 47
Verify
mainafter every squash-merge: Don't trust the green "Merged". - Distinctive: line 53
Do this even when a deploy/cluster already shows the change — you may have applied from a local tree that had commits the squash dropped.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Merging stacked / dependent PRs (the squash-drop gotcha)
The bite: when PR-B's base branch is PR-A's head branch (a stacked PR), or
when you push a late commit to an open PR right before merging, a
squash + --delete-branch on the base bites:
- Deleting the base branch auto-closes the dependent PR. GitHub closes PR-B
when the branch it targets disappears (or retargets it to
mainwith a now-wrong, ballooned diff that includes PR-A's changes). - Squash silently drops commits. A squash collapses the branch tip into one
commit. If the merged PR's head wasn't what you thought — a commit you pushed
seconds before merging, or commits that really live in the base PR — those
changes never reach
main, even though the working tree/cluster you deployed from had them.mainand reality then disagree.
Safe procedure
- Prefer not to stack. Rebase each branch directly onto
mainand open independent PRs. Independent PRs squash-merge in any order without interaction. - If PRs are stacked, merge bottom-up, one at a time. Before merging or
deleting the base (PR-A), retarget the dependent PR to
mainfirst:
Confirm the retarget, then merge PR-A. Do not passgh pr edit <B> --base main # retarget BEFORE deleting PR-A's branch--delete-branchon a base PR while any open PR still targets its branch. - Fold late edits into one commit. If you push a new commit to an
already-open PR just before merging, either squash locally first or re-verify
the PR head includes it (
gh pr view <n> --json commits) before merging. - Verify
mainafter every squash-merge. Don't trust the green "Merged". Confirm the merged branch actually landed all intended changes:
Do this even when a deploy/cluster already shows the change — you may have applied from a local tree that had commits the squash dropped.git fetch origin -q git show origin/main:path/to/file | grep <the-change>
Recovery
- Dependent PR auto-closed: reopen it,
gh pr edit <B> --base main, rebase ontomain, push. - Commits dropped from a squash: land them via a small follow-up PR (a "reconcile main" PR) rather than re-opening the merged one.
Real incident (2026-07-06, geo-agent-ops)
A fleet model-config roll: each app's PR carried a picker-entry commit, then a
llm_model default commit pushed later. Two of twelve squash-merges captured
only the first commit — main kept the old default while the deployed pods
already served the new one (applied from the local tree). The cross-check tool
caught one; the other slipped it (its value lived in a file the tool doesn't read)
and was only found by a manual git show origin/main sweep. Fixed with
follow-up default-only PRs. Lesson: after squash-merging, always confirm main
contains everything — a squash is not a guarantee.
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.

