> ## Documentation Index
> Fetch the complete documentation index at: https://docs.r28.ai/charter/llms.txt
> Use this file to discover all available pages before exploring further.

# repos_rename_branch

> Rename a branch. GitHub answers immediately but finishes in the background, and pushes to the old name fail while it is running. Renaming the default branch needs admin permission.

<div className="tool-route"><span className="tool-row-method" data-method="POST">POST</span><code>{"https://api.github.com/repos/{owner}/{repo}/branches/{branch}/rename"}</code></div>

```python github_repos_rename_branch.py theme={null}
from charter.packs import github

result = await github.repos_rename_branch.ainvoke({"owner": ..., "repo": ..., "branch": ..., "newName": ...})
```

<Note>
  Requires `repo`, `read:user`.
</Note>

## Path parameters

<div className="reference-table">
  | Field                                                          | Type     | Description                                                                                               |
  | -------------------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------- |
  | `owner` <span className="required" title="required">\*</span>  | `string` | The account owner of the repository. The name is not case sensitive.                                      |
  | `repo` <span className="required" title="required">\*</span>   | `string` | The name of the repository without the `.git` extension. The name is not case sensitive.                  |
  | `branch` <span className="required" title="required">\*</span> | `string` | The name of the branch. Cannot contain wildcard characters. A plain name — `main`, not `refs/heads/main`. |
</div>

## Body

<div className="reference-table">
  | Field                                                           | Type     | Description                 |
  | --------------------------------------------------------------- | -------- | --------------------------- |
  | `newName` <span className="required" title="required">\*</span> | `string` | The new name of the branch. |
</div>
