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

# Branching

> Work on your app's code without touching the version people already use. Create branches, protect the important ones, review changes in pull requests, and decide when to publish or deploy.

A **branch** is a version of your app's code. You can change it, preview it, share it, and review it. The default branch stays exactly as it was until you decide to bring the changes in.

> [!NOTE]
>
> This section is about **code branches**. They are not the same as [environments](https://archie.com/docs/backend/environments.md), which branch your project's backend data and configuration. The two work together. See [Branches and environments](#branches-and-environments) below.

## What has branches

Each part of your app that is stored as code has its own set of branches.

| Part | Where you find its branches | Notes |
| - | - | - |
| **Frontend** | The branch chip in the Frontend header, next to the backend environment control. | One set of branches for the whole Frontend. The chip appears after the Frontend is generated. |
| **Logic services** | The branch chip under the header of each service in **Backend > Logic**. | Every service has its own branches, default branch, and protection. See [Branches in a Logic service](https://archie.com/docs/backend/logic/branches.md). |

The branches of the Frontend and of each service are independent. Creating a branch in the Frontend does not create one in a service, and the other way around. You can be on `main` in the Frontend and on `fix-prices` in a service.

## Key concepts

* **Branch.** A version of the code of one part of your app. A new branch starts as a copy of the branch you create it from, at its latest commit.
* **Default branch.** The branch every part starts with. You can change which branch is the default. See [Change the default branch](https://archie.com/docs/frontend/branching/working-with-branches.md#change-the-default-branch).
* **Protected branch.** A branch where nobody writes directly: not the chat, not the code editor, not the visual editor. Changes reach it only through a merge. No branch is protected when it is created. See [Protected branches](https://archie.com/docs/frontend/branching/protected-branches.md).
* **Pull request.** A proposal to merge one branch into another, with a place to review, comment, and resolve conflicts. See [Pull requests](https://archie.com/docs/frontend/branching/pull-requests.md).
* **Commit.** A saved point in the history of a branch.
* **Environment.** Where deployed code runs and where your data lives, such as `master` or `staging`.

## Branches and environments

This is the most important distinction in this section.

* **Branches isolate code.** Changing a file on a branch does not change any other branch.
* **Data lives in environments, and every branch connected to an environment shares it.** A table, its rows, and its schema belong to an environment such as `master`. If you change a table while you work on a branch, the change applies to that environment's data, and every branch connected to that environment sees it.

| If you change... | Is it isolated to the branch? |
| - | - |
| A file of the Frontend or of a service | Yes. |
| The design with the visual editor or the theme editor | Yes. The edit is written to the branch you are on. The design system itself belongs to the project and is shared by all branches. |
| A table, a column, an enum, or an index | **No.** It changes the data of the environment. |
| The rows of a table | **No.** They live in the environment. |

For a side-by-side comparison, see [Environments and code branches](https://archie.com/docs/backend/environments.md#environments-and-code-branches).

The chat asks for confirmation before it changes a table from a branch other than the default. See [The chat and branches](https://archie.com/docs/frontend/branching/chat-and-branches.md#changing-a-table-from-a-branch).

Publishing and deploying also depend on environments. You publish the Frontend from a branch and a commit, and you deploy a service from a branch and a commit **to an environment**. See [Previews, sharing, and publishing](https://archie.com/docs/frontend/branching/previews-and-publishing.md).

## What a merge does not do

A merge, including the merge of a pull request, only moves code between branches. **It never publishes your site and never deploys a service.** After a merge, you publish the Frontend with **Publish** and deploy a service with **Deploy**.

## A typical flow

1. **Create a branch** from the default branch, for example `new-pricing-page`.
2. **Work on it** with the chat, the code editor, or the visual editor. Everything is saved to that branch, and the preview shows it.
3. **Share a preview link** if you want feedback before you merge.
4. **Open a pull request** into the default branch and get it reviewed by people, by Archie Reviewer, or both.
5. **Merge.** The default branch now contains your changes. Nothing is live yet.
6. **Publish** the Frontend or **deploy** the service when you decide to.

## Guides

> [card] [Working with branches](https://archie.com/docs/frontend/branching/working-with-branches.md)
>
> The branch menu, creating, switching, and deleting branches, and the **Manage branches** panel.

> [card] [Protected branches](https://archie.com/docs/frontend/branching/protected-branches.md)
>
> What protection blocks, how to keep working, and protection rules.

> [card] [Pull requests](https://archie.com/docs/frontend/branching/pull-requests.md)
>
> Open a pull request, request reviews, resolve conflicts, and merge.

> [card] [Archie Reviewer](https://archie.com/docs/frontend/branching/archie-reviewer.md)
>
> The AI reviewer: when it runs, what it checks, and what it consumes.

> [card] [Previews, sharing, and publishing](https://archie.com/docs/frontend/branching/previews-and-publishing.md)
>
> Per-branch previews, share links, and publishing the Frontend.

> [card] [The chat and branches](https://archie.com/docs/frontend/branching/chat-and-branches.md)
>
> Where the chat writes and what it asks before it writes.

> [card] [Permissions](https://archie.com/docs/frontend/branching/permissions.md)
>
> What Owners, Admins, Editors, and Viewers can do.

> [card] [FAQ and troubleshooting](https://archie.com/docs/frontend/branching/faq.md)
>
> Common questions and what the messages mean.


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