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

# Branches

> Work on a copy of a project without touching the original, then merge it back or delete it.

A branch is a copy of your project you can change freely. Use one to try a risky change, explore a second direction, or let a teammate work in parallel. When you are done, merge it back or delete it.

Branches are on every plan, with no limit on how many you make. Generating on a branch uses credits like any other generation.

## Start a branch

1. On the canvas, click **New branch** next to the project name. Once a project has more than one branch, the button becomes the branch menu: click the branch name, then **New branch** at the bottom.
2. Type a **Branch name**, such as "New checkout flow". Letters a–z, numbers and dashes work; spaces become dashes. The dialog shows the name as it will be saved, under **Will be created as**.
3. Under **Start from**, pick the branch to copy. The new branch starts from its latest version.
4. Click **Create branch**.

Polymet switches you to the new branch and opens a new thread named after it. The name cannot be changed later.

![The New branch dialog with the Branch name field and the Start from menu](https://mintcdn.com/polymet/TfIzLh80_L4bW9xQ/images/docs/team/new-branch-dialog.png?fit=max\&auto=format\&n=TfIzLh80_L4bW9xQ\&q=85\&s=d5b44094045b138cce7dc8dfff737e2f)

## Switch branches

Click the branch name next to the project name to open the branch menu. It lists every branch with when it last changed and who has it open. The default branch, marked **Default**, comes first. Click a branch to switch to it.

* The address in your browser names the branch, so a link you share opens the same branch.
* Each branch runs one generation at a time. Work on one branch never waits for another.
* Threads belong to the whole project. Each message shows the branch it was sent on, and opening a thread switches you to the branch it was last used on.
* If you have unsaved edits, Polymet asks what to do with them before you switch.

The agent creates, switches or merges branches only when you ask it to.

## Merge a branch

When you are on a branch other than the default one, its row in the branch menu has two buttons that merge with the default branch. The same two are in every branch's **⋯** menu, where you can pick any other branch.

* **Update from…** brings changes from another branch into this one. Use it to catch up with main.
* **Merge into…** sends this branch's changes into another branch. Use it when the work is done.

The dialog shows what the merge will change before you confirm: **Changed previews**, with each branch's current design side by side, and **Changed files**. Click **Merge** (or **Update**) to go ahead.

With **Merge into…**, the box to delete the branch after merging (for example "Delete dark-mode after merging") is ticked by default. Untick it to keep the branch. Once it is deleted, rolling the other branch back will not bring its changes back.

## When a merge conflicts

If both branches changed the same files, the dialog says "Both branches changed these files, so they can't be merged automatically. Nothing was changed." and lists the files.

Click **Solve with AI**. Polymet opens one of the two branches and writes a prompt in the generation input asking the agent to bring the other one in and fix those files. Nothing is sent until you send it, and the agent asks in the thread before it merges.

With **Merge into…**, the box "Merge dark-mode into main when solved" (with your branch names) is ticked by default, so the agent finishes the merge on the branch you are merging into. Untick it to fix the conflicts on your own branch instead and leave the other branch untouched.

## Delete a branch

Open the branch's **⋯** menu and click **Delete**. The dialog, such as "Delete dark-mode?", counts the versions only that branch has and warns that its preview links will stop working. Click **Delete branch**. This cannot be undone. The threads stay.

The default branch cannot be deleted. On a project linked to GitHub, you can also delete the branch there.

## What only the default branch does

Only the default branch reaches the people using your live app. These run on the default branch only:

* Publishing a prototype. On another branch, **Publish** shows "Only main can be published", with **Switch to main**.
* Releasing a design system. On another branch, the dialog says "Only main can be released".
* The project's picture on the projects page.
* Changes to your [backend](https://docs.polymet.ai/backend/overview.md): database changes, the agent writing data, updating backend functions, and setting secrets. The agent can still read your data from any branch.

To ship work from a branch, merge it into the default branch. On a project imported from GitHub, the default branch keeps its GitHub name, such as master, and the messages use that name.

## Related

* [Compare options side by side](https://docs.polymet.ai/canvas/compare.md) — put the same page from two branches next to each other
* [Versions and rollback](https://docs.polymet.ai/team/versions.md) — go back to an earlier version
* [Sync a project with a repository](https://docs.polymet.ai/github/sync.md) — branches mirror to GitHub under the same name
* [Work at the same time](https://docs.polymet.ai/team/live.md) — see who is on which branch


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.