Documentation Index
Fetch the complete documentation index at: https://trunk-4cab4936-mintlify-sync-from-docs-1778014214.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
How it works
Trunk Merge Queue determines PR dependencies by examining each pull request’s base branch (the branch it will merge into, shown under the PR title on GitHub).- If a PR’s base branch is your main branch (e.g.,
main), it’s ready to process immediately - If a PR’s base branch is another feature branch (indicating it’s part of a stack), Merge Queue will wait until that base branch changes to your main branch before processing
Merging stacked PRs
Step 1: Enqueue all PRs in your stack
Each PR in the stack must be enqueued separately. You can:- Comment
/trunk mergeon each PR - Check the box in the Trunk comment on each PR
- Use the CLI:
trunk merge <pr-number>for each PR
Step 2: Automatic sequential processing
Once enqueued, Trunk handles the rest automatically:- The first PR in the stack (base branch =
main) enters the queue, runs tests, and merges - When it merges, GitHub automatically updates the next PR’s base branch from the previous feature branch to
main - The second PR now has
mainas its base, so it proceeds through the queue - This continues until all PRs in the stack are merged
- PR #1 (base:
main) → tests → merges - PR #2’s base automatically changes from PR #1’s branch to
main→ tests → merges - PR #3’s base automatically changes from PR #2’s branch to
main→ tests → merges - And so on…
Important considerations
Sequential testing
PRs in a stack are tested and merged one at a time in order. The second PR won’t begin testing until the first PR has fully merged. This ensures:- Each PR is tested against the actual state of your main branch
- No conflicts arise from dependencies
- Test results are deterministic and reliable
Enqueued PRs with non-main base branches
If you enqueue a PR whose base branch is not your main branch and that base never changes to main, the PR will remain in the queue without processing. This typically happens if:- The parent PR in the stack was not enqueued or merged
- You’re testing queue behavior with a non-standard workflow