rebase-stack

Rebases stacked pull requests bottom-up, verifies each branch, and force-pushes with lease.

Updated Dec 25, 2021
One-click install
npx skills add https://github.com/kotahashihama/dotfiles --skill rebase-stack-kotahashihama
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rebase-stack
Source: https://github.com/kotahashihama/dotfiles/tree/main/home/.claude/skills/rebase-stack
Command: npx skills add https://github.com/kotahashihama/dotfiles --skill rebase-stack-kotahashihama

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Maintaining a stack of dependent pull requests is tedious and error-prone: when a lower branch changes, every upper branch must be rebased in order, conflicts must be judged case by case, and a wrong force-push can destroy someone else's work. This Skill automates the propagation while enforcing the safety checks humans often skip. ## Core Features & Use Cases - Stack Discovery and Ordering: Builds the stack order from the base-branch chain of your open PRs via gh pr list, or accepts an explicit order, and refuses to touch PRs authored by others. - Branch-by-Branch Rebase Propagation: Rebases each branch onto the one below it, runs lightweight verification (build, type check, lint) per branch, and pushes with --force-with-lease. - Decision-Point Handling: Detects merged branches (zero-commit rebases), stale remote refs, and conflicts, then stops and asks the user instead of guessing. - Use Case: You have three stacked PRs and the bottom one just got review feedback. Ask the Skill to re-propagate the stack; it rebases each branch, runs checks, pushes safely, and reports one line per branch. ## Quick Start Ask the assistant to rebase and push my stacked pull requests from bottom to top using the rebase-stack skill.

Frequently Asked Questions about rebase-stack

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

FAQPage Schema
How do I rebase stacked pull requests on GitHub?

Rebase each branch onto the branch directly below it, starting from the bottom of the stack, then push with git push --force-with-lease. This Skill automates that loop, determines the stack order from PR base branches, and verifies each branch before pushing.

How to propagate changes through dependent git branches?

Switch to each branch in bottom-up order, run git rebase onto its parent branch, run a quick build and lint check, then force-push with lease. The Skill repeats this per branch and runs the full test suite only on the topmost branch.

Why use force-with-lease instead of force when pushing rebased branches?

force-with-lease refuses the push if the remote branch changed since your last fetch, preventing you from overwriting someone else's commits. If the lease check fails, the Skill stops and reports the remote state instead of escalating to a plain force push.

What happens when a rebase conflict occurs in a stacked PR?

The Skill never auto-resolves conflicts because choosing which side's intent to keep is an implementer's decision. It stops at the conflicting branch, reports the situation, and asks whether to abort the rebase or how to resolve it.

Can this Skill rebase pull requests authored by other people?

No. It checks each PR's author with gh pr view and refuses to process any branch not authored by you, since force-pushing rewrites history and would be destructive on someone else's branch.