跳转到内容
Try Gitea Cloud ☁️ for 30 days → Accelerate your Development & Deploys!
Support
This is the documentation of 24.7.0, which is no longer the latest release. See the latest release.

Update a branch

PATCH
/repos/{owner}/{repo}/branches/{branch}
curl --request PATCH \
--url https://gitea.example.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

UpdateBranchRepoOption options when updating a branch in a repository

object
name
required

New branch name

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

APIEmpty is an empty response

Media typeapplication/json

APIForbiddenError is a forbidden error response

Media typeapplication/json
message
string
url
string

APINotFound is a not found empty response

Media typeapplication/json

APIValidationError is error format response related to input validation

Media typeapplication/json
message
string
url
string