.nh .TH "GT-PR-CLEAN" "1" "Nov 2026" "gitea-cli" "gitea-cli Manual" .SH NAME gt-pr-clean - Delete the branches of a merged or closed pull request .SH SYNOPSIS \fBgt pr clean [ | | ] [flags]\fP .SH DESCRIPTION Delete the local branch of a merged or closed pull request and its head branch on Gitea, switching to the repository's default branch first when the local branch is checked out, and then fast-forwarding that branch. .PP The local branch is the one at the pull request's head commit, or behind it, that pr checkout created or that has the head branch's name; --ignore-sha selects it by name alone, even with commits that are not in the pull request. A Git remote that pr checkout added for a fork goes with it once no branch tracks it. .PP The head branch on Gitea is kept when you cannot push to it or another open pull request uses it, and gt refuses to clean when it moved past the pull request. gt never deletes the default branch, the branches of an open pull request, or, without --ignore-sha, a local branch with commits that are not in the pull request. Deleting asks for a confirmation; without a terminal, pass --yes. .PP gt pr list --local shows which local branches belong to a merged or closed pull request. .SS ARGUMENTS .EX 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. .EE .SS JSON FIELDS .EX default_branch, local_branch, remote, remote_branch, remote_deleted, remote_skip_reason, remote_skipped, removed_remote .EE .SH OPTIONS \fB-h\fP, \fB--help\fP[=false] help for clean .PP \fB--ignore-sha\fP[=false] Find the local branch by name instead of commit hash .SH OPTIONS INHERITED FROM PARENT COMMANDS \fB--csv\fP[=""] Output CSV with the specified comma-separated \fBfields\fR, or all fields .PP \fB--cwd\fP="" Working \fBdirectory\fR for repository discovery .PP \fB--debug\fP[=false] Log the method, URL, status, and duration of each HTTP request to stderr .PP \fB--host\fP="" Gitea instance \fBURL\fR, including any base path .PP \fB--interactive\fP[=false] Allow prompts with machine output .PP \fB-q\fP, \fB--jq\fP="" Filter JSON output using a jq \fBexpression\fR; implies --json .PP \fB--json\fP[=""] Output JSON with the specified comma-separated \fBfields\fR, or all fields .PP \fB--no-input\fP[=false] Disable prompts and implicit editor/browser interactions .PP \fB--remote\fP="" Git \fBremote\fR used for repository discovery .PP \fB-R\fP, \fB--repo\fP="" Select a repository as \fBOWNER/REPO\fR or URL .PP \fB--sudo\fP="" Perform API requests as this \fBuser\fR (requires an administrator account) .PP \fB--user\fP="" Account \fBname\fR on the selected instance .PP \fB-y\fP, \fB--yes\fP[=false] Accept confirmations without prompting .SH EXAMPLE .EX # After #13 was merged, delete its branch locally and on Gitea $ gt pr clean 13 .EE .SH SEE ALSO \fBgt-pr(1)\fP