Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/repos/addAppAccessRestrictions.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ octokit.repos.addAppAccessRestrictions({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
<tr><td>apps</td><td>yes</td><td>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/addStatusCheckContexts.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ octokit.repos.addStatusCheckContexts({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
<tr><td>contexts</td><td>yes</td><td>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/addTeamAccessRestrictions.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ octokit.repos.addTeamAccessRestrictions({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
<tr><td>teams</td><td>yes</td><td>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/addUserAccessRestrictions.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ octokit.repos.addUserAccessRestrictions({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
<tr><td>users</td><td>yes</td><td>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/createCommitSignatureProtection.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ octokit.repos.createCommitSignatureProtection({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/deleteAccessRestrictions.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ octokit.repos.deleteAccessRestrictions({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/deleteAdminBranchProtection.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ octokit.repos.deleteAdminBranchProtection({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/deleteBranchProtection.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ octokit.repos.deleteBranchProtection({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/deleteCommitSignatureProtection.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ octokit.repos.deleteCommitSignatureProtection({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/deletePullRequestReviewProtection.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ octokit.repos.deletePullRequestReviewProtection({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/getAccessRestrictions.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ octokit.repos.getAccessRestrictions({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/getAdminBranchProtection.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ octokit.repos.getAdminBranchProtection({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/getAllStatusCheckContexts.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ octokit.repos.getAllStatusCheckContexts({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/getAppsWithAccessToProtectedBranch.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ octokit.repos.getAppsWithAccessToProtectedBranch({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/getBranch.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ octokit.repos.getBranch({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/getBranchProtection.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ octokit.repos.getBranchProtection({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/getCommitSignatureProtection.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ octokit.repos.getCommitSignatureProtection({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/getPullRequestReviewProtection.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ octokit.repos.getPullRequestReviewProtection({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/getStatusChecksProtection.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ octokit.repos.getStatusChecksProtection({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/getTeamsWithAccessToProtectedBranch.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ octokit.repos.getTeamsWithAccessToProtectedBranch({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/getUsersWithAccessToProtectedBranch.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ octokit.repos.getUsersWithAccessToProtectedBranch({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/removeAppAccessRestrictions.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ octokit.repos.removeAppAccessRestrictions({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
<tr><td>apps</td><td>yes</td><td>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/removeStatusCheckContexts.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ octokit.repos.removeStatusCheckContexts({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
<tr><td>contexts</td><td>yes</td><td>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/removeStatusCheckProtection.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ octokit.repos.removeStatusCheckProtection({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/removeTeamAccessRestrictions.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ octokit.repos.removeTeamAccessRestrictions({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
<tr><td>teams</td><td>yes</td><td>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/removeUserAccessRestrictions.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ octokit.repos.removeUserAccessRestrictions({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
<tr><td>users</td><td>yes</td><td>
Expand Down
66 changes: 66 additions & 0 deletions docs/repos/renameBranch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
name: Rename a branch
example: octokit.repos.renameBranch({ owner, repo, branch, new_name })
route: POST /repos/{owner}/{repo}/branches/{branch}/rename
scope: repos
type: API method
---

# Rename a branch

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](https://docs.github.com/github/administering-a-repository/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.

```js
octokit.repos.renameBranch({
owner,
repo,
branch,
new_name,
});
```

## Parameters

<table>
<thead>
<tr>
<th>name</th>
<th>required</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr><td>owner</td><td>yes</td><td>

</td></tr>
<tr><td>repo</td><td>yes</td><td>

</td></tr>
<tr><td>branch</td><td>yes</td><td>

The name of the branch.

</td></tr>
<tr><td>new_name</td><td>yes</td><td>

The new name of the branch.

</td></tr>
</tbody>
</table>

See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/repos#rename-a-branch).
2 changes: 1 addition & 1 deletion docs/repos/setAdminBranchProtection.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ octokit.repos.setAdminBranchProtection({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/setAppAccessRestrictions.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ octokit.repos.setAppAccessRestrictions({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
<tr><td>apps</td><td>yes</td><td>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/setStatusCheckContexts.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ octokit.repos.setStatusCheckContexts({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
<tr><td>contexts</td><td>yes</td><td>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/setTeamAccessRestrictions.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ octokit.repos.setTeamAccessRestrictions({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
<tr><td>teams</td><td>yes</td><td>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/setUserAccessRestrictions.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ octokit.repos.setUserAccessRestrictions({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
<tr><td>users</td><td>yes</td><td>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/updateBranchProtection.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ restrictions.teams
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
<tr><td>required_status_checks</td><td>yes</td><td>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/updatePullRequestReviewProtection.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ octokit.repos.updatePullRequestReviewProtection({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
<tr><td>dismissal_restrictions</td><td>no</td><td>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/updateStatusCheckPotection.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ octokit.repos.updateStatusCheckPotection({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
<tr><td>strict</td><td>no</td><td>
Expand Down
2 changes: 1 addition & 1 deletion docs/repos/updateStatusCheckProtection.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ octokit.repos.updateStatusCheckProtection({
</td></tr>
<tr><td>branch</td><td>yes</td><td>

branch+ parameter
The name of the branch.

</td></tr>
<tr><td>strict</td><td>no</td><td>
Expand Down
Loading