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

# Branches mode

> Everyone works in their own Branch and publishes it when ready. Nobody waits for anyone else.

Branches mode is for small teams working on separate changes at the same time. Each person works in their own **Branch** and publishes it when ready. Nobody waits for anyone else, and nobody's changes get mixed up with anyone else's.

<img className="block dark:hidden" src="https://mintcdn.com/polyai/8AhCJDrELJ5yBVXl/images/deployment/deployment-branches-mode-light.svg?fit=max&auto=format&n=8AhCJDrELJ5yBVXl&q=85&s=49468d28092150bd237f6d1695b16a49" alt="Branches mode: Branches in Sandbox publish onto Live, with an optional move to Staging" style={{ maxWidth: '920px', width: '100%', margin: '0 auto' }} width="940" height="512" data-path="images/deployment/deployment-branches-mode-light.svg" />

<img className="hidden dark:block" src="https://mintcdn.com/polyai/8AhCJDrELJ5yBVXl/images/deployment/deployment-branches-mode-dark.svg?fit=max&auto=format&n=8AhCJDrELJ5yBVXl&q=85&s=bfb0777a14afbbd69641756b8dc5702d" alt="Branches mode: Branches in Sandbox publish onto Live, with an optional move to Staging" style={{ maxWidth: '920px', width: '100%', margin: '0 auto' }} width="940" height="512" data-path="images/deployment/deployment-branches-mode-dark.svg" />

## Watch it

<Frame caption="Branches mode walkthrough (7 min)">
  <video controls preload="metadata" title="Branches mode walkthrough" style={{ width: '100%', aspectRatio: '16 / 9', borderRadius: '8px', display: 'block' }}>
    <source src="https://polyai-docs-media.s3.us-east-2.amazonaws.com/deployments/branches-mode.mp4" type="video/mp4" />

    Your browser does not support the video tag.
  </video>
</Frame>

## What a Branch is

A Branch is your own separate copy of the agent. Anything you change in your Branch stays in your Branch until you publish. Your colleagues each have their own, and none of them can see or affect yours.

All Branches live in [Sandbox](/environments-and-versions/environments), the environment where you build and test. A Branch saves as you go. Test it at any time by running [simulation tests](/testing/simulation-tests), or by talking to your agent over an in-app call or chat. Your API and app connections work here too. To test the way a customer would experience it, for example by calling a real phone number, move the Branch to [Staging](/environments-and-versions/environments#staging).

When you are ready, publish your Branch. Its changes are added onto Live and become the newest version in Live's history.

<Frame caption="Every open Branch on the Deployments page, with one of them in Staging">
  <img src="https://mintcdn.com/polyai/8AhCJDrELJ5yBVXl/images/deployment/deployments-branches-list.png?fit=max&auto=format&n=8AhCJDrELJ5yBVXl&q=85&s=5f8eee502fe760b061b98f34e5dee41b" alt="Branches tab on the Deployments page listing open Branches, one marked Staging" style={{ maxWidth: '720px', width: '100%', margin: '0 auto', display: 'block' }} width="2848" height="1682" data-path="images/deployment/deployments-branches-list.png" />
</Frame>

The navigation bar at the top shows whether you are looking at Live or a Branch, and lets you switch between them.

<Warning>
  Branches cannot merge into each other. Each one publishes to Live on its own. To split one piece of work across several people, use [Sub-branches mode](/environments-and-versions/sub-branches-mode).
</Warning>

## Making a change

The everyday case: a knowledge update, a settings change, a behaviour prompt tweak.

<Steps>
  <Step title="Create a Branch from Live">
    It starts as a copy of the current Live version, so you are working from what customers actually hear.
  </Step>

  <Step title="Make your change">
    It saves as you go.
  </Step>

  <Step title="Test it">
    Run [simulation tests](/testing/simulation-tests) on the Branch, or talk to the agent yourself over an in-app call or chat.
  </Step>

  <Step title="Move to Staging (optional)">
    Move the Branch to [Staging](/environments-and-versions/environments#staging) from its actions menu on the Deployments page, then test it the way a customer would.

    <Tip>
      Skip this step unless you need to test on a real channel.
    </Tip>
  </Step>

  <Step title="Publish">
    The changes in your Branch are added onto Live and become the newest version in Live's history.
  </Step>
</Steps>

Nothing else rides along with your change, and nobody else's work is touched.

## Handling an out of sync Branch

Your Branch started as a copy of Live. If a colleague publishes while you are still working, Live has moved on and your Branch is now **out of sync**. Publishing is blocked until you catch up, so that your publish cannot undo their change.

<Frame caption="Publishing is unavailable until the Branch is synced with Live">
  <img src="https://mintcdn.com/polyai/8AhCJDrELJ5yBVXl/images/deployment/publish-menu-out-of-sync.png?fit=max&auto=format&n=8AhCJDrELJ5yBVXl&q=85&s=05bd1e237734b4b9c1d639811834aace" alt="Publish menu on an out of sync Branch, with Publish greyed out and labelled Sync with live first" style={{ maxWidth: '720px', width: '100%', margin: '0 auto', display: 'block' }} width="2848" height="1682" data-path="images/deployment/publish-menu-out-of-sync.png" />
</Frame>

<Steps>
  <Step title="Your Branch is marked Out of sync">
    This is expected, not an error. It just means Live has changed since you started.
  </Step>

  <Step title="Sync">
    This pulls the latest Live changes into your Branch, alongside your own.
  </Step>

  <Step title="Resolve any conflicts">
    If you and your colleague both changed the same thing, a screen asks which version to keep. Everything else merges on its own.
  </Step>

  <Step title="Test, then publish">
    Check the combined result before you publish.
  </Step>
</Steps>

## Checking what will change before you publish

Open the **Publish** menu and choose **Compare changes** to see your Branch against Live side by side, and confirm only the change you intended is there. You can also compare any two Branches, or two versions in Live's history.

<Frame caption="The Publish menu on a Branch">
  <img src="https://mintcdn.com/polyai/8AhCJDrELJ5yBVXl/images/deployment/publish-menu-branch.png?fit=max&auto=format&n=8AhCJDrELJ5yBVXl&q=85&s=7807e886ad1bc405206ae1d68ae81e49" alt="Publish menu showing View branch history, Compare changes with live, Move to staging, Publish, Publish as an A/B test and Delete branch" style={{ maxWidth: '720px', width: '100%', margin: '0 auto', display: 'block' }} width="2848" height="1682" data-path="images/deployment/publish-menu-branch.png" />
</Frame>

For how to read a comparison, see [Compare changes](/environments-and-versions/diffs).

## Undoing a publish

If a change goes wrong after publishing, put an earlier version of Live back. See [Roll back a change](/environments-and-versions/introduction#rolling-back-a-change).
