GitHub: a pull request in a stack does not merge
A stack is a series of pull requests in the same repository where each pull request targets the branch of the pull request below it, forming a chain that lands on a single branch, the stack's base (its trunk). Before a pull request in a stack can merge, it must meet every branch protection requirement for the stack's base, all pull requests below it must meet those requirements too, and the stack must have a fully linear history between its branches (GitHub's stacked pull requests, checked October 26, 2026).
main ← PR #1 ← PR #2 ← PR #3 merging PR #3: #1 and #2 also need their reviews and checks, and land with it
What the merge needs
- The rules of the stack's base: required reviews, required status checks, code owners and code scanning workflows are evaluated as if each pull request targets the stack's base, not the branch directly below it. A mid-stack pull request is held to the same standard as the bottom one, and workflows run for every pull request in the stack (see checks on every pull request in a stack).
- The pull requests below it: merging PR #3 in the stack above requires PR #1 and PR #2 to also pass checks, have required reviews and satisfy all branch protection rules. A mid-stack pull request cannot merge in isolation: the pull requests below it always merge with it.
- A linear history: a stack loses it when changes are pushed to a lower branch, or when the trunk moves ahead. The merge box then shows Rebase stack, and the stack must be rebased before it can merge.
- A change in a lower layer: make it in the branch it belongs to rather than at the current layer:
gh stack down(orgh stack checkout BRANCH), commit, thengh stack rebase --upstackrebases the branches above, andgh stack pushpushes them with--force-with-lease(GitHub's making changes to a lower layer). - One repository: all branches of a stack must be in the same repository; stacks across forks are not supported.
- Required deployments: they are evaluated against the stack's base too, and deploying a pull request also satisfies the requirement for the pull requests below it while the stack has a linear history (GitHub's stacked pull requests reference; see a pull request blocked until deployments succeed).
- No closed pull request in the middle: closing a pull request in the middle of a stack blocks all the pull requests above it from being mergeable. The stack relationship is kept, so to open a different pull request or change the stack, dissolve it with Unstack on the GitHub website and create it again, or restructure it with
gh stack modify. Unstacking removes only the open, draft and closed pull requests; merged and queued ones stay in the stack (troubleshooting stacked pull requests).
To merge a stack from the IDE: Pull Request Inbox for GitHub, a plugin for JetBrains IDEs, lands a pull request in a stack together with the open pull requests below it through GitHub's asynchronous merge, or adds them to the base branch's merge queue.
What does not work for a stack
- Auto-merge: GitHub's merging stacked pull requests no longer says that stacks do not support auto-merge (November 16, 2026). The GraphQL API has
includeStackonenablePullRequestAutoMerge, which turns on auto-merge "for this pull request and any eligible pull requests below it in the stack", and ondisablePullRequestAutoMerge,autoMergeRequestandviewerCanEnableAutoMerge(GitHub's GraphQL reference for pull requests). - The REST merge endpoint: "Merge a pull request" (
PUT /repos/OWNER/REPO/pulls/NUMBER/merge) does not support stacked pull requests or merging with a merge queue. "Merge a pull request asynchronously" is the required API for merging stacked pull requests, and for a pull request in a stack it includes all open pull requests below it (GitHub's REST API endpoints for pull requests). - Bypassing the rules: only the bottom pull request can be merged with bypass rules; the whole stack cannot.
What to do
- Rebase the stack: click Rebase stack in the merge box for a cascading rebase on GitHub's side, or run
gh stack rebaseand thengh stack push. Rebasing generates signed commits, and keeps approvals when a pull request's diff does not change, even with the rule that dismisses stale approvals enabled. - When signed commits are required: GitHub's how-to says the commits of a server-side rebase from the pull request are not signed, and to rebase from GitHub CLI so the commits follow your local Git signature configuration (rebasing your stack). Its reference page says rebasing a stack generates signed commits, so check the commits before merging (see unsigned commits).
- Merge from the bottom up: go to the lowest unmerged pull request, or to a higher one to merge a contiguous group up to it. It lands together with all unmerged pull requests below it as a single operation, and the next unmerged pull request is then rebased to target the stack's base directly.
- After the bottom one merges:
gh stack sync --prunefetches the latest changes, fast-forwards the trunk, rebases the remaining branches onto it, pushes them and syncs the pull request status;--prunealso removes the local branches of merged pull requests (GitHub's syncing your local environment after merges). - When a sync stops on a conflict: if
gh stack syncfinds a conflict, it restores all branches to their original state, so nothing is left partly updated. Resolve the conflict by running the rebase directly,gh stack rebase, then push withgh stack push(a sync stopped because of a conflict). - Through the REST API:
PUT /repos/OWNER/REPO/pulls/NUMBER/merge-async, withmerge_actiondirect_mergeormerge_queue, answers 202 with a UUID;GET …/merge-async/UUIDthen gives the result:pending,merged,enqueued(added to a merge queue, not merged yet) orfailed, with a message. At the request only basic checks run (a closed pull request or a draft gets 400); branch protection rules and repository rules are not run at that stage. A result is kept for 24 hours after its last update. - With a merge queue: all pull requests of the stack are added to the queue in order, and when one is removed from the queue, all pull requests above it are removed too. To keep a stack together, a merge group may exceed its maximum size by up to 50 percent.
- Find the rules: anyone with read access to a repository can view its active rulesets (GitHub's about rulesets); look at the ones on the stack's base, not on the branch the pull request targets directly.
- When the merge stops partway, or a rebase conflicts: checks run before any merge, but a merge can still fail, for example on an unexpected conflict or an intermittent failure. Merging then stops at that pull request: the ones below it that merged stay on the base branch, and the failed one and those above it stay open. Fix the failed one and merge again to land the rest (merging stopped partway). When
gh stack rebasestops on a conflict, it lists the files; resolve them,git add, thengh stack rebase --continue, orgh stack rebase --abortto put all the branches back as they were before the rebase (a rebase reports a conflict). - When gh stack modify will not start: it needs a clean starting state: an active stack checked out, a clean working tree, no rebase in progress, no pull request queued to merge, and a linear commit history; if the history is not linear, run
gh stack rebasefirst (a modify session won't start). - When a modify session was interrupted: a snapshot from before
gh stack modifyis cached locally, andgh stack modify --abortrestores the stack to that state. To keep going instead, resolve the conflict, stage the files withgit addand rungh stack modify --continue(a modify session was interrupted).
In IntelliJ IDEA: Merge sends the request GitHub does not take for a stack
Checked in the IntelliJ IDEA source on November 2, 2026: GithubApiRequests.kt, GHPRDetailsServiceImpl.kt, GraphQL files.
Merge…, Squash and Merge… and Rebase in the IDE all send the REST merge request:
PUT /repos/OWNER/REPO/pulls/N/merge
GitHub says this endpoint does not support stacked pull requests (above). merge-async, the request it requires for them, appears nowhere in the IDE's repository (GitHub: the branch merges through a merge queue). If GitHub refuses the merge, the IDE only writes the error to its log (GitHub: a merge or push is blocked by commit metadata rules).
None of its 78 GraphQL files or its REST requests deals with stacks (GitHub: checks run on every pull request in a stack), so nothing in it shows that a stack needs Rebase stack, or which pull requests are below. Rebase the stack on GitHub or with gh stack rebase. Auto-merge for a whole stack (GraphQL includeStack) is not in the IDE either (GitHub: why auto-merge was refused).
GitHub pull requests in IntelliJ IDEA
Pull Request Inbox for GitHub, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, shows a pull request's reviews, checks and conversations next to the diff, and merges it with the methods the target branch allows. For a pull request in a stack, Merge goes through GitHub's asynchronous merge and lands it together with the open pull requests below it, onto the stack's base, or adds them to that branch's merge queue; its merge checks say that it is part of a stack and read the rules of the stack's base, and auto-merge is not offered for it. The review inbox, diffs and conversations are free; approving, commenting, resolving and merging are Pro (US$1.50 a month, with a 30-day trial).
Get it on JetBrains Marketplace
GitHub is a trademark of GitHub, Inc.; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by GitHub, Inc. or JetBrains.
More: GitHub merge refused (405, 409) · GitHub review refused (422) · GitHub search 422 "Validation Failed" · "Resource not accessible by personal access token" · 401 "Bad credentials" · "Resource protected by organization SAML enforcement" · "API rate limit exceeded" · GitHub diff 406 "too_large", 3,000 files · GitHub line comment 422 "must be part of the diff" · GitHub branch update refused (422) · GitHub pull request not created (422, 403) · GitHub auto-merge refused · GitHub draft, ready for review or close refused · GitHub conversation not resolved · GitHub checks not shown (check runs 403) · GitHub file contents not read · GitHub compare refused (404, 422) · GitHub comment or reply refused (403 locked, archived) · GitHub merge method not allowed (405) · GitHub branch not found (404, 301) · GitHub Enterprise Server not reached · GitHub review request not shown · GitHub pull request list incomplete · GitHub 404 Not Found, renamed repositories (301, 307) · GitHub line comment outdated or not on the diff · GitHub pull requests not updating, notifications late · GitHub suggested change cannot be applied · GitHub required check stuck at "Expected" · GitHub code owner review required · GitHub merge blocked by unresolved conversations · GitHub merge blocked by unsigned commits · GitHub branch that merges through a merge queue · GitHub merge waiting for an approval of the most recent push · GitHub merge waiting for code scanning results · GitHub merge waiting for code quality results · GitHub merge blocked by a code coverage threshold · GitHub merge blocked by license compliance results · GitHub branch locked or its updates restricted · GitHub branch not deleted after merging · GitHub merge waiting for a team's approval (Required reviewers) · GitHub merge blocked by secret scanning alerts · GitHub push blocked by push rules · GitHub merge blocked by commit metadata rules · GitHub force push blocked · GitHub issue not closed by a merged pull request · GitHub pull request not checked out locally · GitHub pull request has merge conflicts · GitHub changes requested and dismissing a review · GitHub co-author not credited for a commit · GitHub dependency review check failed · GitHub Dependabot not rebasing its pull request · GitHub fork not syncing with upstream · GitHub pull request base branch not changing · GitHub pull request not reverting · GitHub pull request template not showing · GitHub pull request labels or assignees not added · GitHub pull request not closing or reopening · GitHub push blocked by push protection · GitHub pull request comment hidden · GitHub pull request blocked until deployments succeed · GitHub team review request replaced by members · GitHub pull request file no longer marked Viewed · GitHub pull request marked merged without being merged · GitHub Copilot review does not count as an approval · GitHub checks not running on a pull request a workflow created · GitHub Update branch button not shown on a pull request · GitHub checks failing on a Dependabot pull request · GitHub checks failing on a pull request from a fork · GitHub checks skipped by [skip ci] in a commit message · GitHub checks gone after the retention period · GitHub code review limits in a public repository · GitHub pull requests turned off or limited in a repository · GitHub checks run on every pull request in a stack · GitHub pull request showing commits already squash merged · GitHub pull request not showing a file diff · GitHub push to a pull request branch from a fork refused · GitHub check cancelled on a pull request · GitHub Rebase and merge not available · GitHub merge commit message not what you expected · GitHub pull request shows every line changed · GitHub API request timed out · GitHub pull request image or document diff not shown · GitHub review request refused (422) · GitHub pull request from Copilot: checks not running, approval not counted · GitHub push refused: GH006 and GH013 on a protected branch · GitHub "At least 1 approving review is required", approvals that do not count · GitHub pull request plugins for IntelliJ IDEA, compared · 日本語