# Using branches

{% hint style="warning" %}
Please be sure of your agent type and version and pick the right documentation accordingly.
{% endhint %}

{% tabs %}
{% tab title="Node.js" %}
{% hint style="danger" %}
This is the documentation of the `forest-express-sequelize` and `forest-express-mongoose` Node.js agents that will soon reach end-of-support.

`forest-express-sequelize` v9 and `forest-express-mongoose` v9 are replaced by [`@forestadmin/agent`](https://docs.forestadmin.com/developer-guide-agents-nodejs/) v1.

Please check your agent type and version and read on or switch to the right documentation.
{% endhint %}
{% endtab %}

{% tab title="Ruby on Rails" %}
{% hint style="success" %}
This is still the latest Ruby on Rails documentation of the `forest_liana` agent, you’re at the right place, please read on.
{% endhint %}
{% endtab %}

{% tab title="Python" %}
{% hint style="danger" %}
This is the documentation of the `django-forestadmin` Django agent that will soon reach end-of-support.

If you’re using a Django agent, notice that `django-forestadmin` v1 is replaced by [`forestadmin-agent-django`](https://docs.forestadmin.com/developer-guide-agents-python) v1.

If you’re using a Flask agent, go to the [`forestadmin-agent-flask`](https://docs.forestadmin.com/developer-guide-agents-python) v1 documentation.

Please check your agent type and version and read on or switch to the right documentation.
{% endhint %}
{% endtab %}

{% tab title="PHP" %}
{% hint style="danger" %}
This is the documentation of the `forestadmin/laravel-forestadmin` Laravel agent that will soon reach end-of-support.

If you’re using a Laravel agent, notice that `forestadmin/laravel-forestadmin` v1 is replaced by [`forestadmin/laravel-forestadmin`](https://docs.forestadmin.com/developer-guide-agents-php) v3.

If you’re using a Symfony agent, go to the [`forestadmin/symfony-forestadmin`](https://docs.forestadmin.com/developer-guide-agents-php) v1 documentation.

Please check your agent type and version and read on or switch to the right documentation.
{% endhint %}
{% endtab %}
{% endtabs %}

## Using branches

As we've explained in the previous page, your Admin panel's frontend is saved on Forest Admin servers. As a result, you can't version it. But don't worry, we've got you covered with some great tools!

#### What is a layout?

The notion of branch cannot be explained without first explaining what a *layout* is.

A **layout** is all the settings that **define your user interface (UI)**. In Forest Admin, there is 1 layout per environment and per team:

<figure><img src="https://2014605362-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fx9GURwd0RAwi8uWZgH5v%2Fuploads%2FG9kUSVQ9wRctxZdBh8g8%2Fusing_branches_1.jpg?alt=media&#x26;token=3faac2bc-5be8-4a08-8d00-6a5883dc8039" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
To manipulate your layouts, you will be using [Forest CLI](https://docs.forestadmin.com/documentation/reference-guide/how-it-works/developing-on-forest-admin/forest-cli-commands).
{% endhint %}

#### What is a branch?

A branch is a fork (i.e copy) of the layout of its *origin* environment. It is attached to your development environment.

{% hint style="info" %}
The **origin** of a branch is either specified using the `--origin` option or selected when prompted otherwise). You should choose the environment you want to make some layout changes on.
{% endhint %}

Once you've created a branch, your layout will look exactly like the layout of its origin environment.

#### How do branches work?

Any **layout change** you make on your current branch using the [Layout Editor](https://docs.forestadmin.com/user-guide/getting-started/master-your-ui/using-the-layout-editor-mode) will be **saved on your current branch** and will not affect its origin environment.

Imagine the following situation where you have 3 environments:

<figure><img src="https://2014605362-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fx9GURwd0RAwi8uWZgH5v%2Fuploads%2FQaTbG2X4UdMqaj749y2R%2Fusing_branches_2.jpg?alt=media&#x26;token=a4ca4e1a-e5a4-4ff0-b3f0-2c63b4a4c740" alt=""><figcaption></figcaption></figure>

The branch `my-branch` is based on the production layout. Any changes made on it are saved in your branch's layout and can later be [applied ](https://docs.forestadmin.com/documentation/reference-guide/how-it-works/developing-on-forest-admin/forest-cli-commands/deploy)on it.

<figure><img src="https://2014605362-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fx9GURwd0RAwi8uWZgH5v%2Fuploads%2FGWGjc4cQQzrrb0GugtKi%2Fusing_branches_3.jpg?alt=media&#x26;token=2a244e7a-9310-4c2e-b03b-d8c5642e7df5" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
This also means that any changes made to the origin of your branch will instantly reflect on your branch.\
\
For those familiar with git's *rebase*, this means you will **never have to** **rebase** your branch on its origin.
{% endhint %}

#### How do you create a branch?

To create a branch, you'll need to use [Forest CLI](https://docs.forestadmin.com/documentation/reference-guide/how-it-works/developing-on-forest-admin/forest-cli-commands). Make sure you've created your local development environment using the [init](https://docs.forestadmin.com/documentation/reference-guide/how-it-works/developing-on-forest-admin/forest-cli-commands/init) command. Then, to create a branch named `my-branch` based on your `production` environment, simply run:

```
forest branch my-branch --origin production
```

{% hint style="info" %}
Using kebab-case is recommended; however, should you want to use spaces in your branch name, don't forget to surround it with quotes, like so `forest branch "my branch" --origin ...`.
{% endhint %}

To learn more about the `branch` command, please visit [this page](https://docs.forestadmin.com/documentation/reference-guide/how-it-works/developing-on-forest-admin/forest-cli-commands/branch).

#### Checking your branch information

On your interface, you can check at all times what branch you are on and how many layout changes were made: they appear in the top banner. The `X branches pushed` information is relevant for remote environments only: it shows how many branches were already pushed onto it.

![](https://2014605362-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fx9GURwd0RAwi8uWZgH5v%2Fuploads%2Fgit-blob-45a5f9dcc495a9a221a66747fb49c8b64890e8b1%2Fcurrent-branch-layout-changes-count-display.png?alt=media)

{% hint style="info" %}
To switch your *current* branch to another existing branch, check out the [switch](https://docs.forestadmin.com/documentation/reference-guide/how-it-works/developing-on-forest-admin/forest-cli-commands/switch) command.
{% endhint %}

Now that you've mastered branch creation and management, let's dive into the next step of the development workflow: deployment


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.forestadmin.com/documentation/reference-guide/how-it-works/developing-on-forest-admin/using-branches.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
