Basic merge queues
A merge queue serializes pull requests that are ready to merge, ensuring that each PR is tested against the latest state of the target branch before it actually merges.
- CD pipeline includes at least one gate (tests pass, security scan, approval)
- Merge queue is implemented (GitHub merge queue, Mergify, or equivalent)
- Auto-rebase is enabled for PRs targeting main branch
- Merge conflicts are detected and flagged before review is requested
- Deploy frequency is at least daily
- Merge queue configuration in repository settings or CI
- Auto-rebase configuration (branch protection rules, bot configuration)
- CD pipeline definition showing gate conditions
- Delivery L1 (CI/CD Pipeline) - CI pipeline must exist for merge queue to function
What It Is
A merge queue serializes pull requests that are ready to merge, ensuring that each PR is tested against the latest state of the target branch before it actually merges. Without a merge queue, two PRs can both pass CI independently and then fail when merged together - a "merge race" that causes integration failures and forces manual remediation. A merge queue eliminates this by testing each PR in sequence (or in batches) against the branch as it will actually look after all preceding PRs merge.
GitHub natively supports merge queues as of 2023. When enabled, clicking "Merge" on a PR doesn't merge it immediately - it adds the PR to the queue. The queue continuously tests PRs in order, and each PR is merged only after CI passes with all preceding queued PRs already merged in. Mergify offers a more configurable alternative with batch merging, custom ordering rules, and richer policy support.
At L2, basic merge queues means: the queue is enabled, PRs flow through it in FIFO order, and CI must pass in the queue context before merge. This is the minimum viable configuration. It doesn't yet include custom ordering, priority lanes, batch merging optimization, or conflict pre-detection. But it eliminates the most common class of merge failures - race conditions between concurrent PRs - which becomes a significant operational problem as PR volume grows.
The value of merge queues scales non-linearly with PR throughput. At 5 PRs/day, merge races are rare. At 50 PRs/day, they're constant. At 200+ PRs/day (typical for AI-augmented teams), without a merge queue the integration failure rate can exceed 30% of PRs - meaning a third of all CI runs are wasted on code that will never reach main without remediation. A merge queue makes this problem impossible by construction.
Why It Matters
- Eliminates merge races - two PRs that both pass CI independently can still fail when merged together; a merge queue ensures each PR is tested against the exact state of main it will merge into, making "it passed CI but broke main" impossible
- Enables higher PR throughput - teams hesitate to merge quickly when merge races are common because each merge might break the branch; with a queue, merging is safe regardless of how many concurrent PRs exist
- Required for auto-merge - auto-merge policies (L4) only work safely in the context of a merge queue; without queuing, auto-merge at high volume produces the race condition problem at scale
- Reduces "fix the merge" overhead - without a queue, the team designates someone to watch for merge failures and manually rebase/retry; with a queue, this disappears
- Creates an observable merge pipeline - a merge queue makes the state of "ready to merge" explicit; you can see what's queued, in what order, and what CI status each item has
Getting Started
- Enable GitHub's native merge queue - go to repository Settings > Branches > Branch protection rules > enable "Require merge queue." Select "Squash and merge" or "Rebase and merge" as the merge method (squash is recommended for clean history). This is the fastest path to a working merge queue.
- Configure CI to run in queue context - when using GitHub's merge queue, CI runs against the "merge group" (the PR rebased onto main with all preceding queued PRs applied). Verify your CI workflow handles
merge_grouptrigger events, not justpull_request. - Set minimum CI requirements - in the branch protection rule, configure which CI checks must pass in the merge queue context. Start with your most critical checks: build, unit tests, integration tests. Don't block on flaky tests (they'll jam the queue).
- Communicate the workflow change to the team - the user experience changes: instead of clicking "Merge" and seeing code merge immediately, developers click "Add to merge queue" and wait for the queue to process their PR. Brief the team on what this looks like and why the wait is worth it.
- Monitor queue wait time for the first two weeks - if the queue is processing slowly (PRs wait 20+ minutes), investigate: is CI too slow? Are there too many serialized tests? Queue latency directly impacts developer experience. Target under 10 minutes from "added to queue" to "merged."
- Handle flaky test strategy - a flaky test in the merge queue context is more damaging than in normal CI, because a flaky failure blocks the entire queue. Identify your flaky tests before enabling the merge queue and either fix or quarantine them.
GitHub's merge queue has a "minimum group size" setting that batches multiple PRs together for a single CI run, improving throughput at the cost of some ordering determinism. At L2, leave this at 1 (no batching). Introduce batching at L3 when you've confirmed your CI is stable and fast enough to handle queue load.
Common Pitfalls
Enabling the queue without fixing flaky tests first. A flaky test in normal CI causes a developer to re-run CI once. A flaky test in a merge queue can cause an entire queue drain to fail, blocking all queued PRs until the flaky test is fixed or skipped. Audit your flaky test rate before enabling the queue and address the worst offenders.
CI that doesn't trigger on merge_group events. If your CI workflows only trigger on pull_request events, they won't run in the merge queue context. PRs will be added to the queue but no checks will run, and the queue will either hang or merge without validation. Always add merge_group to your CI trigger event list.
Treating the queue as a substitute for review. A merge queue ensures tested integration, not correctness. PRs should still be reviewed before being added to the queue. The common mistake is using "it's in the queue" as a substitute for "it's been reviewed." Review approval should remain a requirement before queue entry.
Not monitoring queue depth and wait times. A merge queue that takes 30 minutes per PR at 50 PRs/day creates a 25-hour queue backlog. This makes the queue worse than no queue, because PRs pile up stale and require rebasing before they can even enter the queue. Monitor queue wait time from day one and treat anything over 15 minutes as a CI performance problem.
Forgetting to configure the queue for all relevant branches. Teams often enable merge queues on main but forget protected release branches (release/v2.x, stable). PRs to those branches continue to have race conditions. Apply the queue configuration to all branches that receive concurrent PR merges.
How Different Roles See It
Bob's team has been experiencing "it worked in CI but broke main" failures about twice a week. The team lead calls these "merge conflicts" but they're actually merge races - two PRs that each passed CI independently conflicting on merge. Developers are frustrated by the rework, but the problem feels like bad luck rather than a fixable process issue.
What Bob should do: Bob should recognize this pattern as a solved problem. Merge races at this frequency are exactly what merge queues are built to prevent. He should ask the team lead to enable GitHub's native merge queue for the repository and configure CI to run on merge_group events. This is a 2-hour implementation, not a sprint project. Bob should frame it as "we're spending roughly 4 developer-hours per week on merge conflict remediation; here's a 2-hour fix that eliminates it permanently." The ROI framing makes this a straightforward infrastructure investment, not a tooling preference.
Sarah has noticed that CI failure rates are higher than she'd expect for a team that's careful about code quality. When she investigates, she finds a significant portion of CI failures are "integration failures after merge" - code that passes all checks in isolation but fails when it reaches main. These don't show up in her "CI pass rate" metric because they fail after merge, not before.
What Sarah should do: Sarah should add a "post-merge failure rate" metric to her dashboard. This measures how often code fails after merging to main (detected by CI on main failing after a PR merge). A high post-merge failure rate is a merge queue signal - it means the team is merging without queue-context testing. Sarah should connect this metric to developer frustration: post-merge failures generate "fix the broken build" interruptions that derail in-progress work. Presenting this as a developer experience metric (interruption rate due to merge failures) gives Bob the organizational justification for implementing the queue.
Victor has already enabled merge queues on his personal projects and knows they work. He wants to enable them for the team's main repositories but the infrastructure team is worried about "introducing another thing that can break the deploy pipeline."
What Victor should do: Victor should propose a time-boxed pilot: enable GitHub's native merge queue on one non-critical repository for 30 days, measure queue wait times, CI failure reduction, and developer experience. A non-critical repository reduces the risk and lets the team build confidence. Victor should also prepare a migration checklist: which CI workflows need merge_group triggers, which branch protection rules need updating, which tests are flaky and need quarantine before queue enablement. Having a concrete implementation plan rather than a general proposal is what converts infrastructure team skepticism into cooperation.
Further Reading
From the Field
Recent releases, projects, and discussions relevant to this maturity level.
Where does your team actually sit on this?
This guide describes one level of one area. Run the assessment to place your team across all 16 areas, see which gates you have passed, and get a report you can take to your stakeholders.
Merge & Deploy