GitHub: the branch merges through a merge queue
Repository administrators can require a merge queue on a branch: "Require merge queue" in a branch protection rule, or the merge_queue rule of a ruleset ("Merges must be performed via a merge queue"). A pull request into that branch is then not merged directly. Once it has passed all required branch protection checks, a user with write access to the repository adds it to the queue; the queue makes sure its changes pass all required status checks when applied to the latest version of the target branch and any pull requests already in the queue, and GitHub then merges it with the merge method set for the queue (GitHub's managing a merge queue and merging a pull request with a merge queue). GraphQL's isMergeQueueEnabled says whether the pull request's base branch has a merge queue, and mergeQueueEntry where the pull request is in it (checked October 26, 2026).
POST /graphql pullRequest(number: N) { isMergeQueueEnabled isInMergeQueue mergeQueueEntry { position state } }
POST /graphql enqueuePullRequest(input: { pullRequestId: ID, expectedHeadOid: SHA }) { mergeQueueEntry { position } }
PUT /repos/OWNER/REPO/pulls/N/merge-async { "merge_action": "merge_queue", "sha": SHA }
Why it is not merged directly
- REST's merge endpoint: "Merge a pull request" (
PUT /repos/OWNER/REPO/pulls/N/merge) does not support merging with a merge queue; GitHub recommends the asynchronous merge API instead (GitHub's REST API endpoints for pull requests). - The asynchronous merge:
PUT …/merge-asyncmerges in the background or adds the pull request to a merge queue. Itsmerge_actiondefaultuses a merge queue if one is configured for the target branch,merge_queueadds to the queue,direct_mergemerges without it. A 202 means the request was accepted and runs in the background; a 200 comes back at once if the pull request is already merged or already in a merge queue, and "enqueued" means added to the queue, not merged; a 400 means it cannot be merged (closed, still a draft), as only basic pull request state checks run at that stage, not branch protection rules or repository rules; a 409 means another merge request is already pending for it. The commit title, message andmerge_methodapply to direct merges only. - GraphQL:
enqueuePullRequestadds the pull request only if it can be added immediately; if it cannot, the mutation returns an error that explains why.expectedHeadOidis the head it expects, andjumpadds it to the front of the queue.dequeuePullRequestremoves it. - On GitHub: "Merge when ready" adds the pull request to the queue. Clicked before all requirements pass, it enables auto-merge and adds the pull request when they are met, even if "Allow auto-merge" is disabled for the repository. An administrator may merge directly with "Merge without waiting for requirements to be met (bypass branch protections)", if the branch protection settings allow it.
What the queue does with it
- A merge group: the queue groups the pull request's changes with the latest version of the base branch and the pull requests ahead of it, on a temporary branch with a special prefix, dispatches a
merge_groupevent of typechecks_requested, and merges once the checks the base branch requires pass. Pull requests are merged first in, first out. - Your checks must run on the merge group: a GitHub Actions workflow that reports a required check needs the
merge_groupevent as a trigger, separate frompull_requestandpush; without it the check is not reported and the merge fails (see a required check stuck at "Expected"). Another CI service must run on pushes to branches beginning withgh-readonly-queue/{base_branch}, whose SHA differs from the pull request's. - The settings: the merge method; build concurrency (1 to 100
merge_groupwebhooks at once); whether only non-failing pull requests merge (a ruleset'sgrouping_strategy: ALLGREEN, every pull request's merge commit in the group must pass, or HEADGREEN, only the head of the group); the status check timeout, after which checks that have not reported count as failed; and the minimum and maximum group size with a wait time. A branch protection rule with*in its branch name pattern cannot enable a merge queue. - Where it stands: GraphQL gives the entry's
position,state(QUEUED, AWAITING_CHECKS, MERGEABLE, UNMERGEABLE, LOCKED) andestimatedTimeToMerge. On GitHub, the Branches page and the merge queue link at the bottom of the pull request's timeline show the queue. Jumping to the top makes every pull request in progress build again.
Why it left the queue
- The reasons GitHub lists: the CI service reported test failures for a merge group; the queue timed out awaiting a successful CI result; a user removed it through the API or the merge queue interface; a branch protection failure could not be resolved automatically; or, grouped with the latest target branch and the changes ahead of it, it had failed required status checks or conflicts with the base branch.
- The timeline says why: the pull request's timeline shows the reason it was removed. The pull requests behind it are grouped again without its changes.
What to do
- Add it to the queue: use Merge when ready on GitHub,
enqueuePullRequest, ormerge-asyncwithmerge_actionmerge_queue, rather than the direct merge endpoint. - Pass the branch's rules first: the pull request must meet them before it can join: approving reviews (see a code owner's review), resolved conversations (see the merge waits for conversations), signed commits (see unsigned commits), required checks.
- Make the checks run on the merge group: add
merge_groupto the workflows that report required checks, or run your CI ongh-readonly-queue/branches. - After a removal: read the reason in the timeline, fix it, and add the pull request again.
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. When GitHub calls the pull request blocked, its merge checks name what they can read: required checks that have not reported, a review still required, unresolved conversations and unsigned commits the rules hold against it. When the target branch merges through a merge queue, its Merge adds the pull request to the queue (GraphQL's enqueuePullRequest), and the merge checks say that the branch merges through a queue, or where the pull request is in it and whether it is waiting for checks, can be merged or cannot. 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).
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 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 stacked pull request not merging · 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 · 日本語