GT-PR-MERGE(1) gitea-cli Manual GT-PR-MERGE(1)

gt-pr-merge - Merge a pull request

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

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.

--admin merges although the branch protection is not met, if Gitea lets you bypass the branch protection. --match-head-commit SHA merges only while the head of the pull request is still that commit, so a push after you reviewed it is not merged unseen; otherwise gt exits with 6. Neither can be combined with --auto, as a scheduled merge does not keep them. --disable-auto cancels the merge that --auto scheduled, and merges nothing.

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.

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

--admin[=false] Merge although the branch protection is not met, if Gitea lets you bypass the branch protection

--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)

--disable-auto[=false] Cancel the merge that --auto scheduled, and merge nothing

--dry-run[=false] Show the write requests gt would send, without sending them

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

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

--match-head-commit="" Merge only if the head of the pull request is this commit sha

--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

--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)

--template="" Format JSON output using a Go template; implies --json (see gt help formatting)

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

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

# 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
# Merge only the commit that was reviewed, and cancel a scheduled merge
$ gt pr merge 13 --squash --match-head-commit 4b825dc
$ gt pr merge 13 --disable-auto
# 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

gt-pr(1)

Nov 2026 gitea-cli