Skip to main content

Stacked pull requests generally available

By Steven Van ·

Rebases now preserve approvals for unchanged code, while stack auto-merge is rolling out over the next few weeks.

Large code changes can now be split into a chain of smaller, dependent pull requests with the generally available stacked pull requests feature in GitHub. Each pull request can be reviewed independently, then merged individually or in contiguous groups from the bottom up.

Create and review a stack

Stacks can be created directly on GitHub or with the gh stack extension in GitHub CLI. Review feedback can be addressed anywhere in a stack, with changes cascaded through the remaining layers. The stacked pull requests documentation covers creation, review, management and merging.

Stack information now stays visible in the pull request page’s persistent header, and stack details are available from the pull requests list. Shift + J and Shift + K navigate between pull requests in a stack.

Rebase without losing approvals

Rebase stack now preserves approvals when an otherwise unchanged stack is updated after its base branch moves ahead, including in repositories that dismiss stale approvals. It also creates signed replacement commits while preserving original authorship. Automatic rebases after partial merges sign replacement commits when branch rules require signatures or any original commit was signed.

More flexible merging

  • Users with permission to bypass repository rules can now apply those permissions to merge the lowest unmerged pull request in a stack.
  • A stack enters and lands through the merge queue as a single merge group. With the merge commit method, GitHub creates one merge commit per pull request instead of one for the entire merged group.
  • When a stack’s base branch is deleted, GitHub automatically retargets the stack instead of closing its bottom pull request, supporting stacks that branch off other stacks.

Auto-merge for stacks is rolling out over the next few weeks. A selected group of pull requests will merge together once every pull request is ready and the repository’s merge requirements are met.

GitHub
GitHub
Where the world builds software — Git hosting, pull requests, issues, Actions CI/CD, and Copilot, free for public and private repos.
View GitHub →

Original source

Read Stacked pull requests generally available on Creators Toolbox