gt-pr-merge(1)

gt-pr-merge1

Merge a pull request

Usage

gt pr merge [{<number> | <url> | <branch>}] [flags]

Overview

Merge a pull request on Gitea.

Without a method, gt uses the repository's default merge style. On a terminal, leaving out the method or --delete-branch asks for them, preselecting the repository's defaults. With --delete-branch, gt also deletes the local head branch when it is checked out, switching to the base branch.

--delete-branch deletes the head branch of a pull request from a fork too, when you can push to that fork: your own, or any as a site administrator. A fork you cannot push to keeps it.

For a pull request merged outside Gitea, such as with git merge and git push, --method manually-merged --commit SHA marks it as merged by that commit of the base branch. The repository must allow it (gt repo edit --allow-manual-merge). Gitea does not check that the commit contains the pull request's changes.

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

assignees, author, base, body, comments, created_at, draft, due_date, head,
head_remote_deleted, head_repo, head_sha, id, labels, merge_commit_sha,
mergeable, merged, merged_at, merged_by, milestone, number, review_decision,
reviewer_teams, reviewers, reviews, state, title, updated_at, url

Options

--auto[=false]
Merge once the required checks succeed

--commit=""
Commit sha on the base branch that merged the pull request outside Gitea (with --method manually-merged)

-d, --delete-branch[=false]
Delete the head branch on Gitea and locally after merging (default: the repository setting, on Gitea only)

-e, --editor[=false]
Write the merge commit message in your editor

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

--merge[=false]
Create a merge commit

-b, --message=""
Merge commit message

-F, --message-file=""
Read the merge commit message from file, or - for stdin

-s, --method=""
Merge method (default: the repository's default merge style) {merge|rebase|rebase-merge|squash|fast-forward-only|manually-merged}

--rebase[=false]
Rebase the commits onto the base branch

--squash[=false]
Squash the commits into one commit and merge it

-t, --title=""
Merge commit title

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

# Merge the pull request of the current branch with the repository's default style
$ gt pr merge
# Squash #13 and delete its branch
$ gt pr merge 13 --squash --delete-branch
# Merge once the checks pass, without prompts
$ gt pr merge 13 --auto --yes
# Mark #13 as merged by a commit pushed to the base branch outside Gitea
$ gt pr merge 13 --method manually-merged --commit 4b825dc --delete-branch

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