GitHub Stacked PRs
Key point
GitHub has released stacked PRs and the `gh stack` CLI in preview.
Details
With Stacked PRs, you can split a large change into multiple smaller pull requests, stack them on top of each other, and merge them all at once.
The key idea is that each PR can be reviewed independently while the overall change still flows as one continuous stream. GitHub provides this as native support, and connects it to local work via the gh stack CLI.
The main features are as follows.
- Stack map: See the stack structure at a glance in the GitHub PR UI and move between layers.
- Cascading rebase: Apply changes across the entire stack in a single rebase.
- Merge flexibility: You can merge only part of the stack first, and merge queue can also be used.
- Branch protection rules: Applied based on the final target branch, not the direct base.
- CI behavior: CI runs for each PR in the stack as if it were targeting the final branch.
The gh stack CLI is optional. You can create and manage stacks using just the UI, API, or normal Git workflows, and using the CLI makes branch creation, rebasing, pushing, and PR creation flow more smoothly.
The usage flow is roughly as follows.
- Install with
gh extension install github/gh-stack - Set up an alias so
gh stackbecomesgswithgh stack alias - Create each layer of the stack with
gs init,gs add - Push all branches with
gs push - Open the stack PRs with
gs submit
GitHub states that this feature is in private preview status, and is guiding users to apply for the waitlist.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.