CLI reference

The Trunk CLI allows you to insert and remove PRs into the Merge Queue. You can also pause and resume the queue from the CLI.

Installation

curl -LO https://trunk.io/releases/trunk
chmod +x trunk

Prerequisites

Before using the CLI:

  • Authenticate: Run trunk login

  • Git repository: Execute commands from your repository root

Usage

trunk merge [flags] <pr-number>
trunk merge [subcommand]

Submit a PR to the Queue

trunk merge <pr-number> [flags]

Arguments

<pr-number> - Pull request number to submit. Can be specified with or without # prefix (e.g., 1234 or #1234)

Flags

-p, --priority <0-255> - Priority determines the order PRs are tested and merged. When a PR is submitted with a priority, it will begin testing before any lower priority PR that isn't currently being tested. Levels:

  • 0 (Urgent) Interrupts currently testing PRs to begin testing immediately. Use sparingly as restarting tests is costly. This is the only priority that interrupts running tests

  • 10 (High) Tests before default priority PRs

  • 100 (Default) Used when no priority is specified

  • 200 (Low) Tests after default priority PRs

  • 255 ( Lowest) Lowest possible priority

If multiple PRs have the same priority, they are processed in the order they were submitted. See Priority Levels.

Examples

Check Queue Status

Display a snapshot of merge queue activity for the current branch, including:

  • Recently merged PRs

  • Currently testing PRs

  • PRs waiting in queue

View PR Status and History

Display detailed merge history and timeline for a specific pull request, including:

  • When it was submitted

  • Status changes over time

  • Test results

  • Links to test runs

Example output:

Cancel a PR

Remove a pull request from the merge queue. Use cases:

  • Cancel before making additional changes to the PR

  • Cancel to resubmit with different priority

Pause Queue [admin only]

Pause the merge queue, changing its state from Running to Paused. The ordering of PRs in the queue is preserved while paused.

When to use:

  • CI failure recovery - Stop merges and testing until infrastructure issues are resolved

  • Test infrastructure outages - Pause until systems are back online

  • Emergency situations - Prevent any merges during incident response

  • Scheduled maintenance - Block merges during maintenance window

Resume Queue [admin only]

Resume merge queue processing, changing its state from Paused back to Running. The queue will begin testing waiting PRs in priority order.

Last updated