stacked-prs

Manages stacked pull request chains with safe rebasing, retargeting, and leased branch deletion.

Updated Jun 30, 2026
One-click install
npx skills add https://github.com/Codeseys-Labs/agentic-sdlc --skill stacked-prs-codeseys-labs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stacked-prs
Source: https://github.com/Codeseys-Labs/agentic-sdlc/tree/main/plugin/skills/stacked-prs
Command: npx skills add https://github.com/Codeseys-Labs/agentic-sdlc --skill stacked-prs-codeseys-labs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Dependent changes split across multiple pull requests become dangerous when a lower layer merges, is retargeted, or is rewritten while child PRs remain open. This Skill enforces a strict safety doctrine for stacked PRs so rebases, retargets, and branch deletions never orphan child branches or lose commits. ## Core Features & Use Cases - Boundary preservation: Saves branch, tip, PR number, base/head names, and exact remote OIDs for every layer before any mutation, invalidating candidates on any drift. - Safe restacking: Uses git rebase --onto <new-parent> <saved-old-parent> <child> to replay only each child's commits, cascading from the parent outward. - Leased force-push and deletion: Pushes and deletes remote branches only with --force-with-lease bound to the exact saved remote OID, treating lease failures as stops rather than retries. - Use Case: After PR 1 of a three-layer stack merges, retarget PR 2 to main, rebase PR 3 onto the new parent, re-gate each layer, and delete the merged branch only after verifying no open PR uses it as a base. ## Quick Start Use the stacked-prs skill to restack my open PR chain after the bottom PR merged, retargeting each child and force-pushing with saved-OID leases.

Frequently Asked Questions about stacked-prs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I restack dependent pull requests after the parent merges?

Retarget each immediate child PR to the verified new base, then rebase with git rebase --onto <new-parent> <saved-old-parent> <child> so only that child's commits replay. Re-gate and re-review every rewritten layer before pushing with a saved-OID force-with-lease.

How to safely force-push a rebased branch in a PR stack?

Save the branch's exact remote OID first, then push with git push --force-with-lease=refs/heads/<branch>:<saved-remote-oid>. A lease failure or changed readback is a stop requiring re-query and a fresh candidate, never a retry or plain --force.

When should I use stacked PRs instead of one large pull request?

Use a stack when dependent changes need separate, reviewable PRs, keeping the chain shallow at two to four layers with each PR targeting the branch below it. Independent changes should be parallel PRs, not a stack.

Can I delete a branch while child PRs still target it?

No. Before deleting any branch, re-query all open PRs and their base fields; do not delete while any open PR uses that branch as a base. Deletion must use the exact saved-OID lease after a final race check.

Why does a changed PR base or head invalidate a stacked PR operation?

The safety doctrine treats any drift in target, base, head, or PR state as invalidating the saved candidate boundary. Every check occurs immediately before mutation, so drift requires stopping, re-querying, re-gating, and obtaining fresh review.