gt-pr-backport(1)

gt-pr-backport1

Backport a merged pull request to other branches

Usage

gt pr backport [{<number> | <url> | <branch>}] --to <branch> [flags]

Overview

Cherry-pick the commits a merged pull request left on its base branch onto a new branch for each --to branch, push it and open a pull request into that branch, titled like the original with its number appended, with its labels.

A merge commit backports the commits it merged, a rebase or fast-forward merge its commits, and a squash merge the squashed commit; cherry-picks use -x. The new branch is backport-NUMBER-BRANCH, started from the --to branch of the base repository's remote, and gt switches back to the branch it ran on afterwards. Like gt pr create, it pushes to your fork when you cannot push to the repository; a fork it has to create first is offered only on a terminal, so elsewhere run gt repo fork --add-remote first. Pushing asks for a confirmation; without a terminal, pass --yes.

A cherry-pick that conflicts is undone, and other --to branches are still tried, as they are after a --to branch that already has the pull request's changes. With --keep, gt stops on the backport branch instead: resolve the conflicts, git add them and run git cherry-pick --continue, then run gt pr backport --continue on that branch to push it and open the pull request.

Arguments

A pull request can be supplied as argument in any of the following formats:
- by number, such as "13" or "#13"
- by URL, such as "https://gitea.com/OWNER/REPO/pulls/13"
- by the name of its head branch, such as "feature/login" or "bob:feature/login"; a branch that
  reads as OWNER/REPO#N, such as "fix/login#2", needs the OWNER:BRANCH form
Without an argument, the pull request of the current branch is selected.

Json fields

branch, commits, picked, pull, target

Options

-b, --branch=""
Local branch to cherry-pick onto (default: backport-NUMBER-BRANCH)

--continue[=false]
Push the checked-out backport branch after resolving its conflicts and open its pull request

-h, --help[=false]
help for backport

--keep[=false]
Stop at a conflict to resolve it instead of undoing the backport

-m, --milestone=""
Milestone title or ID of the backport pull request

--to=[]
Branch to backport to (repeatable)

Options inherited from parent commands

--csv[=""]
Output CSV with the specified comma-separated fields, or all fields

--cwd=""
Working directory for repository discovery

--debug[=false]
Log the method, URL, status, and duration of each HTTP request to stderr

--host=""
Gitea instance URL, including any base path

--interactive[=false]
Allow prompts with machine output

-q, --jq=""
Filter JSON output using a jq expression; implies --json

--json[=""]
Output JSON with the specified comma-separated fields, or all fields

--no-input[=false]
Disable prompts and implicit editor/browser interactions

--remote=""
Git remote used for repository discovery

-R, --repo=""
Select a repository as OWNER/REPO or URL

--sudo=""
Perform API requests as this user (requires an administrator account)

--user=""
Account name on the selected instance

-y, --yes[=false]
Accept confirmations without prompting

Examples

$ gt pr backport 42 --to release/v1.2
$ gt pr backport 42 --to release/v1.2 --to release/v1.1 --yes
# Resolve conflicts yourself
$ gt pr backport 42 --to release/v1.1 --keep
$ git add . && git cherry-pick --continue
$ gt pr backport --continue

From gitea-cli 1.0.0-1 in Arch Linux 2026-11-07. Parsed by carta from the page's man source.