# rename_publish_branch

Source: https://modulify.ai/docs/mcp/code/rename-publish-branch

Renames the GitHub branch every publish of a site writes to and builds from.

- Title: Rename the publish branch of a site
- Scope: `code:write`
- Access: Makes changes

This is the **Publish branch** row of the site's **Repository** section, covered in [Rename the publish branch](https://modulify.ai/docs/editor/move-code-to-github#rename-the-publish-branch). The branch is `production` until it is renamed. It only works once the code lives in your GitHub, and it needs a paid plan and the **Transfer projects** permission.

Modulify renames the existing branch on GitHub rather than creating a new one, so its history moves with it and the old name is free for a branch of your own. A name holds letters, numbers, hyphens, underscores and dots, starts with a letter or number and runs to 100 characters. It cannot have two dots in a row or end with a dot or `.lock`, and `preview` and `HEAD` are reserved.

It is refused while a publish is running and when a branch with the new name already exists. When the publish branch was renamed on GitHub itself, pass the name it has now: Modulify switches to it without renaming anything, as long as it is still the default branch of the repository. Anything outside GitHub that still uses the old name, such as a deploy pipeline, has to be changed by you.

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `branch` | string | Yes | The new name of the publish branch. |