Github API - Test Config

POST /repos/{owner}/{repo}/branches/{branch}/rename
repos

Renames a branch in a repository.

Note: Although the API responds immediately, the branch rename process might take some extra time to complete in the background. You won't be able to push to the old branch name while the rename process is in progress. For more information, see "Renaming a branch".

The permissions required to use this endpoint depends on whether you are renaming the default branch.

To rename a non-default branch:

  • Users must have push access.
  • GitHub Apps must have the contents:write repository permission.

To rename the default branch:

  • Users must have admin or owner permissions.
  • GitHub Apps must have the administration:write repository permission.
    Rename a branch

Arguments
key owner

owner [scalar]

The account owner of the repository. The name is not case sensitive.

API:
Github Open API
(version: 1.1.4)

key repo

repo [scalar]

The name of the repository. The name is not case sensitive.

API:
Github Open API
(version: 1.1.4)

key branch

branch [scalar]

The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.

API:
Github Open API
(version: 1.1.4)

Returns
201 application/json branch-with-protection

branch-with-protection [object]

Branch With Protection

Attributes
_links 1934

commit commit

name string

pattern string

protected boolean

protection branch-protection

protection_url string

required_approving_review_count integer

API:
Github Open API
(version: 1.1.4)
403 forbidden

forbidden [scalar]

Forbidden

API:
Github Open API
(version: 1.1.4)
404 not_found

not_found [scalar]

Resource not found

API:
Github Open API
(version: 1.1.4)
422 validation_failed

validation_failed [scalar]

Validation failed, or the endpoint has been spammed.

API:
Github Open API
(version: 1.1.4)
API:
Github Open API
(version: 1.1.4)