Update a branch
PATCH
/repos/{owner}/{repo}/branches/{branch}
const url = 'https://gitea.example.com/api/v1/repos/example/example/branches/example';const options = { method: 'PATCH', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"name":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”owner
required
string
Owner of the repo
repo
required
string
Name of the repo
branch
required
string
Name of the branch
Request Body
Section titled “Request Body”Media typeapplication/json
UpdateBranchRepoOption options when updating a branch in a repository
object
name
required
New branch name
string
Examplegenerated
{ "name": "example"}Responses
Section titled “Responses”APIEmpty is an empty response
Media typeapplication/json
APIForbiddenError is a forbidden error response
Media typeapplication/json
Headers
Section titled “Headers”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
Headers
Section titled “Headers”message
string
url
string