dsh-merging-stacked-prs
Skill2 starsChanged 44 days agoMITView on GitHub
Use when landing a stack of dependent GitHub PRs (A ← B ← C, where each bases on the one below) onto master, 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. Requires every same-repository dependency chain to use GitHub's official stacked-PR feature before landing so GitHub owns stack-wide rules, CI, ordering, retargeting, and merge state.
10 other projects use a version of this, 5 of them edited.
Adopted by
Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data
Most recently taken up by
- See-Sol-Lab/DeepSeekGUIword for word, first seen Oct 18, 2026
- Haifai-AI/baby-whaleedited, first seen Oct 13, 2026
- Yao920127/claude-code-harnessword for word, first seen Oct 11, 2026
- xinyuquan985-coder/deepseek-harness-neonedited, first seen Sep 26, 2026
- Ydjin1984/DeepSeek_Kibborg_Harnessedited, first seen Sep 25, 2026
- SuperJJ007/papermachineword for word, first seen Sep 12, 2026
Used with
Projects with it also use dsh-doc-site-sync and dsh-doc-standards.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
lucaslusSkilldsh-doc-site-sync
Use when publishing, updating, moving, or removing DeepSeek Harness documentation website pages; editing website/docs.ts mappings or navigation; diagnosing a page missing from the VitePress site; fixing projected documentation links; or running the docs:dev, docs:check, and doc-sync workflow after website-content changes.
Also in 5 projects that use this
lucaslusSkilldsh-doc-standards
Use when writing, moving, reviewing, or auditing documentation in the deepseek-harness repo — choosing hierarchy and detail, separating tutorials from references, checking tutorial progression, trimming doc slop, responding to a verify-doc-budgets failure, or requests like "improve the docs", "audit the docs", "where should this be documented", or "this doc is too long".
Also in 5 projects that use this
Other versions10 projects use a version of this.
Word for word · 5
- deepseek-ai/deepseek-harness★ 282k100% same
- See-Sol-Lab/DeepSeekGUI★ 274100% same
- SuperJJ007/papermachine★ 59100% same
- SparkElf/deepseek-harness-plus★ 1100% same
- Yao920127/claude-code-harness★ 1100% same
Edited · 5
- xinyuquan985-coder/deepseek-harness-neon★ 1798% same
- Haifai-AI/baby-whale★ 198% same
- lucaslus/dsh-desktop★ 198% same
- SuperMate-Ai/SuperMate-Harness-System★ 198% same
- Ydjin1984/DeepSeek_Kibborg_Harness★ 190% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository25 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .agents/notes/AGENTS.mdAGENTS.md
- .agents/notes/archived/AGENTS.mdAGENTS.md
- .agents/notes/implemented/AGENTS.mdAGENTS.md
- benchmarks/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- .github/AGENTS.mdAGENTS.md
- packages/AGENTS.mdAGENTS.md
- scripts/AGENTS.mdAGENTS.md
- snapshots/AGENTS.mdAGENTS.md
- vendor/AGENTS.mdAGENTS.md
- website/AGENTS.mdAGENTS.md
- dsh-archive-agent-notesSkill
- dsh-ci-test-reliabilitySkill
- dsh-client-ui-uxSkill
- dsh-code-reviewSkill
- dsh-create-upgrade-guideSkill
- dsh-docSkill
- dsh-find-simplificationsSkill
- dsh-pre-push-checksSkill
- dsh-prose-standardSkill
- dsh-speed-up-perfSkill
- dsh-translate-docsSkill
- dsh-trim-cot-leakageSkill
- record-browser-gifSkill
The file
We split this skill into the rules it gives an agent
9 rules. 5 are common, 0 are distinctive, and 4 are very specific to this project.
5
Common
Most of the 5 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Common: line 14
Use a clean dedicated worktree.
- Common: line 54
When any dependent PR is not yet in that official stack:
- Common: line 57
If all authors match, link the chain automatically in bottom-to-top order:
- Common: line 63
If authors differ or any author is unavailable, ask the user whether to link before changing GitHub state.
- Very specific: line 66
Never dissolve, reorder, or rebuild an existing stack automatically.
- Common: line 70
Do not rewrite branches merely because a refresh mechanism exists.
- Very specific: line 99
Do not bypass merge requirements.
- Very specific: line 103
Wait for every selected PR to report MERGED.
- Very specific: line 111
Delete branches only in a separate final pass after the corresponding PRs report MERGED.
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Landing an official GitHub PR stack
Land dependent PRs through GitHub's native stack object and gh stack merge. Do not reproduce stack semantics by merging and retargeting individual PRs with gh pr merge and gh pr edit. The root AGENTS.md owns the allowed merge-forward and rebase histories; the stack review guide owns review-fix propagation.
Require native stack support
Run gh stack --version before changing GitHub state. Hard-stop if the official extension or server-side stack feature is unavailable; do not fall back to manually merging and retargeting PRs one at a time. GitHub stacks require every head branch to live in the same repository, so hard-stop on a cross-fork chain.
Use a clean dedicated worktree. Fetch current PR metadata and exact head OIDs rather than trusting branch names or an earlier report:
gh pr view <pr> --json number,author,baseRefName,baseRefOid,headRefName,headRefOid,isCrossRepository,state,isDraft,reviewDecision,mergeStateStatus,statusCheckRollupQuery PullRequest.stack and stackEntry.position for at least one PR in each apparent chain; this official GitHub object, not base-branch inference alone, is the stack-membership authority. Paginate entries when size exceeds the returned page:
gh api graphql -F owner=<owner> -F name=<repo> -F number=<pr> -f query='
query($owner: String!, $name: String!, $number: Int!) {
repository(owner: $owner, name: $name) {
pullRequest(number: $number) {
number
author { login }
baseRefName
headRefName
stackEntry { position }
stack {
number
baseRefName
size
entries(first: 100) {
nodes {
position
pullRequest { number author { login } baseRefName headRefName state isDraft }
}
}
}
}
}
}'Establish the expected bottom-to-top order from the live PR bases: the bottom targets the trunk, and each higher PR targets the head branch immediately below it.
Link missing stack members
First compare any existing stack entries with the expected chain. One existing stack may contain an order-preserving subset of the requested chain; multiple stack numbers, an unexpected entry, or a conflicting order requires user direction before any mutation.
When any dependent PR is not yet in that official stack:
- Compare every
author.loginexactly. - If all authors match, link the chain automatically in bottom-to-top order:
gh stack link --base <trunk> <bottom-pr> <next-pr> ... <top-pr>- If authors differ or any author is unavailable, ask the user whether to link before changing GitHub state.
- Re-query GraphQL and require one stack number, the expected trunk, the complete PR set, and the expected positions and base chain.
Never dissolve, reorder, or rebuild an existing stack automatically; gh stack link is additive and merged or queued entries cannot be unstacked.
Refresh only when needed
Do not rewrite branches merely because a refresh mechanism exists. When the live merge state or repository rules require an updated trunk, choose either allowed history:
- Native cascading rebase: check out the remote stack with
gh stack checkout <pr-or-stack>when it is not tracked locally, then rungh stack sync. The command may rebase and lease-protected force-push every active layer before local validation. Immediately inspect the rewritten scope, run the relevant checks for every affected layer, and do not merge or claim readiness until they pass. If sync detects a rebase conflict, usegh stack rebase, resolve and validate it, then publish withgh stack push. If checkout or sync reports divergent local and remote stack compositions, cancel and ask rather than deleting or recreating the remote stack automatically. - Incremental merge-forward: merge the trunk into the bottom affected branch, then propagate each updated parent into its child in bottom-to-top order and push normally. If the base advances during an in-progress merge, preserve that checkpoint before merging the newer tip.
Any history rewrite is allowed after review, but it invalidates commit-OID assumptions. Re-fetch exact heads and re-audit unresolved review threads, approvals, mergeability, and checks after the push. Never use raw --force or overwrite a concurrently advanced remote head.
Preflight the merge range
Re-query the official stack immediately before merging. Require every selected PR to be open, non-draft, in the expected order, and compliant with the repository's review and check requirements. Treat each PR's state independently; a ready top layer does not prove its dependencies are ready.
"Land the stack" selects the whole stack. A partial landing requires an explicit boundary PR and includes every layer from the bottom through that boundary.
Merge through the stack API
Merge the whole stack by its official stack number:
gh stack merge <stack-number> --yes --mergeFor an explicitly requested partial landing, merge through the boundary PR:
gh stack merge <boundary-pr> --yes --mergeDo not pass --delete-branch, manually retarget dependents, or issue per-PR merge commands. GitHub merges the selected range bottom-up and retargets/rebases any remaining upper layers. A direct stack merge is all-or-nothing; when the trunk uses a merge queue, GitHub queues the selected range together but may land it in separate groups.
Do not bypass merge requirements. If the native merge reports a blocker, inspect and resolve that blocker through the owning PR or stop and report it; never fall back to gh pr merge.
Verify the landed state
Wait for every selected PR to report MERGED; a queued request is not a completed landing:
gh pr view <pr> --json number,state,mergedAt,mergeCommit,baseRefName,headRefNameFor a partial landing, re-query the official stack and verify that every remaining PR is still linked in the expected order and targets the stack trunk or the layer below it. Re-check current heads, review state, and CI because GitHub may have rebased the remaining layers.
Delete branches only in a separate final pass after the corresponding PRs report MERGED. Before deleting each branch, require GitHub to report no open PR still using it as a base:
gh pr list --state open --base <branch> --json number --jq lengthAnything other than 0 blocks deletion.
Checklist
- Native
gh stacksupport is available; every PR branch is in the same repository. - Live PR bases and exact heads establish one bottom-to-top dependency chain.
- GraphQL reports one official stack with the expected trunk, entries, and order; an eligible same-author unstacked chain was linked automatically.
- Any rewritten layers passed relevant validation, and review threads, approvals, mergeability, and checks were re-audited afterward.
- The whole stack, or an explicitly bounded prefix, was submitted through
gh stack merge --yes --merge. - Every selected PR reports
MERGED; any remaining upper layers still form the expected official stack. - Branch deletion happened only after merged-state and 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.

