> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trunk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Trunk Merge Queue runs unrelated PRs in independent test lanes instead of one serial line, keeps merging when a flaky test would stall the queue, and batches changes to cut CI runs.

A merge queue sits between your developers and your protected branch. Instead of letting PRs merge as soon as their own CI passes, the queue tests each PR against the head of `main` plus every PR ahead of it — so what merges is what was actually tested, even when ten PRs land in the same hour. That predictive testing model is shared across most modern merge queues.

Trunk Merge Queue runs on four mechanics. Predictive testing is the correctness baseline; the other three are how Trunk makes it fast and resilient.

<Columns cols={2}>
  <Card title="Predictive testing" icon="crystal-ball" href="./optimizations/predictive-testing">
    Test against everything ahead.
  </Card>

  <Card title="Parallel queues" icon="columns-3" href="./optimizations/parallel-queues/">
    Lanes for unrelated PRs.
  </Card>

  <Card title="Anti-flake protection" icon="shield-check" href="./optimizations/anti-flake-protection">
    CI gets a second chance.
  </Card>

  <Card title="Batching" icon="boxes-stacked" href="./optimizations/batching">
    Test many PRs in one CI run.
  </Card>
</Columns>

## When does this make sense?

* Monorepo with lanes of work that don't overlap → parallel queues
* Flaky tests blocking real merges → anti-flake protection
* 50+ PRs/day, CI bill climbing → batching
* Single-track GitHub Merge Queue choking → all three

## More to dial in

Other optimizations worth knowing about:

* [**Priority merging**](./optimizations/priority-merging) — fast-track urgent PRs (hotfixes, incident response) to the front of the queue without bypassing it
* [**Predictive testing internals**](./optimizations/predictive-testing) — how the foundational mechanic actually works
* [**Testing concurrency**](./administration/advanced-settings#testing-concurrency) — how many PRs the queue tests at once
* [**Direct merge to main**](./optimizations/direct-merge-to-main) — skip retesting when a PR is already up to date with `main` and the queue is empty

→ Full list in [Optimizations](./optimizations/).

## Set it up

1. Install the Trunk GitHub App (5 minutes)
2. Create your first queue (2 minutes)
3. Submit a test PR

→ [Get started](./getting-started/).
