{"meta":{"title":"Troubleshooting stacked pull requests","intro":"Resolve common problems with stacked pull requests, including rebase conflicts, blocked merges, interrupted operations, and merge queue issues.","product":"Pull requests","breadcrumbs":[{"href":"/en/pull-requests","title":"Pull requests"},{"href":"/en/pull-requests/how-tos","title":"How-tos"},{"href":"/en/pull-requests/how-tos/merge-and-close-pull-requests","title":"Merge and close"},{"href":"/en/pull-requests/how-tos/merge-and-close-pull-requests/troubleshooting-stacked-pull-requests","title":"Troubleshoot stacked PRs"}],"documentType":"article"},"body":"# Troubleshooting stacked pull requests\n\nResolve common problems with stacked pull requests, including rebase conflicts, blocked merges, interrupted operations, and merge queue issues.\n\n> \\[!NOTE] This feature is in public preview and subject to change.\n\nThis article covers common issues you may encounter when working with stacked pull requests and how to resolve them.\n\n## A rebase reports a conflict\n\nWhen a cascading rebase encounters a conflict, `gh stack rebase` stops and lists the conflicted files.\n\nTo resolve the conflict and continue:\n\n1. Open each conflicted file and resolve the conflict markers (`<<<<<<<`, `=======`, `>>>>>>>`).\n\n2. Stage the resolved files.\n\n   ```shell\n   git add .\n   ```\n\n3. Continue the rebase. The remaining branches are rebased automatically.\n\n   ```shell\n   gh stack rebase --continue\n   ```\n\nIf the conflict is too complex or you want to start over, abort the rebase to restore all branches to their pre-rebase state.\n\n```shell\ngh stack rebase --abort\n```\n\n## A sync stopped because of a conflict\n\nIf a conflict is detected while running `gh stack sync`, all branches are restored to their original state so nothing is left partially updated. Resolve the conflict interactively by running a rebase directly, then push the updated branches.\n\n```shell\ngh stack rebase\ngh stack push\n```\n\n## A modify session won't start\n\n`gh stack modify` requires a clean starting state. If it won't start, confirm that:\n\n* You have an active stack checked out.\n* Your working tree is clean.\n* No rebase is in progress.\n* No pull request is queued to merge.\n* The commit history is linear. If it isn't, run `gh stack rebase` first.\n\n## A modify session was interrupted\n\nIf `gh stack modify` is interrupted, for example, by a conflict you don't want to resolve or a terminal crash, you can restore the stack to the state it was in before you started. A pre-modify snapshot is cached locally for recovery.\n\n```shell\ngh stack modify --abort\n```\n\nIf a conflict occurred while applying changes and you want to keep going instead, resolve the conflict, stage the files with `git add`, then run `gh stack modify --continue`.\n\n## A pull request can't be merged\n\nA pull request in a stack can only merge when it, and every pull request below it, meets all merge requirements, and the stack has a fully linear history. If the merge is blocked, check that:\n\n* The pull request and all pull requests below it have required reviews and passing checks.\n* The stack has a linear history. If changes were pushed to a lower branch or the trunk moved ahead, the history may no longer be linear.\n\nTo restore a linear history, run `gh stack rebase` and then `gh stack push`, or click **Rebase stack** in the merge box. For instructions, see [Managing stacked pull requests](/en/pull-requests/how-tos/create-pull-requests/managing-stacked-pull-requests).\n\n## Merging stopped partway through the stack\n\nPre-merge checks run before any merge, but a merge can still fail. For example, because of an unexpected conflict or an intermittent failure. If a failure occurs part way through, merging stops at that pull request.\n\n* Pull requests below it that merged successfully remain landed on the base branch.\n* The failed pull request and the pull requests above it stay open.\n\nResolve the issue on the failed pull request, then retry the merge to land the rest of the stack.\n\n## A pull request was removed from the merge queue\n\nStacks are kept together in the merge queue. If a pull request is removed or ejected from the queue, all pull requests above it in the stack are also ejected and removed. Re-add the stack to the queue once the underlying issue is resolved.\n\nA large stack may also split across consecutive merge groups: the merge queue allows a merge group to exceed its configured maximum size by up to 50 percent to keep a stack together, and any pull requests that don't fit continue in subsequent groups until the full stack has landed.\n\n## You closed a pull request in the middle of the stack\n\nClosing a pull request in the middle of a stack blocks all pull requests above it from being mergeable. The stack relationship is preserved, so to open a different pull request or change the stack's structure, you must first dissolve the stack and then re-create it.\n\nYou can unstack from the GitHub website, or restructure the stack with `gh stack modify`. Unstacking removes only the open, draft, and closed pull requests; merged and queued pull requests remain in the stack. See [Managing stacked pull requests](/en/pull-requests/how-tos/create-pull-requests/managing-stacked-pull-requests#unstacking-from-the-github-website) and [Managing stacked pull requests](/en/pull-requests/how-tos/create-pull-requests/managing-stacked-pull-requests#restructuring-a-stack).\n\n## You can't create a stack across forks\n\nStacked pull requests require all branches to be in the same repository. Cross-fork stacks are not supported."}