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:

To manipulate your layouts, you will be using Forest CLI.

What is a branch?

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

Your origin environment is generally your production environment, unless you don't have one in which case it will be one of your remote environments.

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

How do branches work?

Any layout change you make on your current branch using the Layout Editor will be saved on your current branch and will not affect your origin environment.

Imagine the following situation where you have 3 environments:

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 moved or applied to other layouts.

This also means that any changes made to the origin environment (i.e production) will instantly reflect on your branch. For those familiar with git's rebase, this means you will never have to rebase your branch on your origin environment (i.e production).

How do you create a branch?

To create a branch, you'll need to use Forest CLI. Make sure you've created your local development environment using the init command. Then, to create a branch named my-branch, simply run:

forest branch my-branch

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

To learn more about the branch command, please visit this page.

Checking your branch information

On your interface, click on the environment dropdown at the top-left side of your screen. Select a developement environment (if you don't have one, see the init command).

Your current branch will be displayed at the top.

To switch your current branch to another existing branch, check out the switch command.

In the Environments dropdown, you can see the number of changes made on the branch/environment.

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