> ## 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.

# Sub-branches mode

> A team shares one Branch, splits the work into Sub-branches, and publishes everything together.

Sub-branches mode is for several people building one update that ships as a package. It works exactly like [Branches mode](/environments-and-versions/branches-mode), with one addition. A Branch can be split into **Sub-branches**, so a team can divide one piece of work between them and publish it all at once.

If you have not read Branches mode, start there. Everything on that page applies here too.

<img className="block dark:hidden" src="https://mintcdn.com/polyai/8AhCJDrELJ5yBVXl/images/deployment/deployment-model-light.svg?fit=max&auto=format&n=8AhCJDrELJ5yBVXl&q=85&s=533abea428e52b3f76804940f0368184" alt="Sub-branches mode: Branches and Sub-branches in Sandbox, one Branch in Staging, publishing onto Live" style={{ maxWidth: '920px', width: '100%', margin: '0 auto' }} width="940" height="582" data-path="images/deployment/deployment-model-light.svg" />

<img className="hidden dark:block" src="https://mintcdn.com/polyai/8AhCJDrELJ5yBVXl/images/deployment/deployment-model-dark.svg?fit=max&auto=format&n=8AhCJDrELJ5yBVXl&q=85&s=3e7b2278394d174b95484b9a3c83fa45" alt="Sub-branches mode: Branches and Sub-branches in Sandbox, one Branch in Staging, publishing onto Live" style={{ maxWidth: '920px', width: '100%', margin: '0 auto' }} width="940" height="582" data-path="images/deployment/deployment-model-dark.svg" />

## Watch it

<Frame caption="Sub-branches mode walkthrough (10 min)">
  <video controls preload="metadata" title="Sub-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/sub-branches-mode.mp4" type="video/mp4" />

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

## What a Sub-branch is

A Sub-branch is a copy made from a Branch, rather than from Live. Each person on the team takes their own Sub-branch, works in it, and merges it back into the shared Branch when their piece is done. Once every piece is in, the team tests the whole Branch together and publishes it. Everything lands on Live at once.

Sub-branches follow the same rules with their Branch that Branches follow with Live. They live in [Sandbox](/environments-and-versions/environments), save as they go, and can be tested at any time.

<Frame caption="A Branch expanded to show its Sub-branches, on the Deployments page">
  <img src="https://mintcdn.com/polyai/8AhCJDrELJ5yBVXl/images/deployment/deployments-sub-branches-list.png?fit=max&auto=format&n=8AhCJDrELJ5yBVXl&q=85&s=bdfee1028a3bf444696f82a559a0537d" alt="Deployments page showing a Branch with two Sub-branches nested under it, and a count of its Sub-branches" style={{ maxWidth: '720px', width: '100%', margin: '0 auto', display: 'block' }} width="2882" height="1682" data-path="images/deployment/deployments-sub-branches-list.png" />
</Frame>

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

## Working on an update with several people

<Steps>
  <Step title="Create one shared Branch">
    One Branch for the whole piece of work.
  </Step>

  <Step title="Each person creates a Sub-branch">
    Every Sub-branch comes off that shared Branch.
  </Step>

  <Step title="Make your changes">
    Each person works in their own Sub-branch. It saves as you go.
  </Step>

  <Step title="Test each Sub-branch">
    Run tests on a Sub-branch to check its changes on their own before merging.
  </Step>

  <Step title="Merge each Sub-branch back">
    Merge into the shared Branch as each piece is finished.
  </Step>

  <Step title="Test the Branch">
    Test all the changes together.
  </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">
    Publish the Branch. Everything lands on Live at once.
  </Step>
</Steps>

If the work can ship separately, skip Sub-branches. Each person creates their own Branch and publishes on their own schedule, exactly as in [Branches mode](/environments-and-versions/branches-mode).

<Warning>
  Branches cannot merge into each other. Each one publishes to Live on its own.
</Warning>

## Handling an out of sync Sub-branch

Out of sync works the same way as in [Branches mode](/environments-and-versions/branches-mode#handling-an-out-of-sync-branch), with one difference. A Branch syncs with Live. A Sub-branch syncs with its parent Branch.

So if a colleague merges their Sub-branch into the shared Branch before you do, your Sub-branch is marked out of sync. Sync to pull their changes into yours, resolve any conflicts, test, then merge.

<Frame caption="Merging is unavailable until the Sub-branch is synced with its Branch">
  <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>

## When someone publishes while Sub-branches are still open

Nothing is lost. Any Sub-branch still open at that point moves to sit directly under Live and becomes a Branch in its own right. Carry on working, then publish it like any other Branch.

## Checking what will change before you publish or merge

Open the **Publish** menu and choose **Compare changes** to see your Branch against Live, or your Sub-branch against its Branch, side by side. Use it to confirm only the change you intended is there.

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).
