Skip to content
Try Gitea Cloud ☁️ for 30 days → Accelerate your Development & Deploys!
This is the documentation of the next version, still under development. See the latest release.

Rename a branch

PATCH
/repos/{owner}/{repo}/branches/{branch}
curl --request PATCH \
--url https://gitea.com/api/v1/repos/example/example/branches/example \
--header 'Authorization: Basic <credentials>' \
--header 'Content-Type: application/json' \
--data '{ "name": "example" }'
owner
required
string

Owner of the repo

repo
required
string

Name of the repo

branch
required
string

Name of the branch

Media typeapplication/json

RenameBranchRepoOption options when renaming a branch in a repository

object
name
required

New branch name

string
unique items
Examplegenerated
{
"name": "example"
}

APIEmpty is an empty response

APIForbiddenError is a forbidden error response

message
string
url
string

APINotFound is a not found empty response

APIValidationError is error format response related to input validation

message
string
url
string