Skip to main content

forest branch

Create, list, or delete layout branches. Branches work similarly to Git branches, but for your Forest UI layout, they let you isolate UI changes while you develop a feature, then push or deploy those changes when ready.

Usage

forest branch [BRANCH_NAME] [options]

Arguments

ArgumentDescription
BRANCH_NAMEName of the branch to create (optional, omit to list branches)

Options

OptionDescription
-d, --deleteDelete a branch
--forceSkip confirmation when deleting a branch
-o, --originSet the origin environment for the new branch
-p, --projectIdThe ID of the project to work on
--formatOutput format: table (default) or json
--helpDisplay usage information

Listing branches

Run forest branch without arguments to list all your existing branches:
$ forest branch
NAME                    ORIGIN      IS CURRENT  CLOSED AT
feature/new-button      production
fix-missing-label       staging
feature/remove-tooltip  preprod                 2022-08-19T08:08:47.678Z
The IS CURRENT column shows your active branch, the one your Development Environment is currently using.

Creating a branch

Append a branch name to create a new branch:
$ forest branch feature/new-ops-feature --origin production
 Switched to new branch: feature/new-ops-feature
Your project must have at least one remote or production environment before you can create branches.
$ forest branch add-refund-action
 You cannot create a branch until this project has either a remote or a production environment.

Branch origins

Every branch needs an origin, the environment whose layout state the branch starts from. Your layout changes build on top of the origin’s layout.
  • If you omit --origin, the CLI prompts you to select one interactively.
  • Branches usually originate from your Production or a Remote Environment.
There are no specific constraints on branch names, but kebab-case is the convention. Branch names must be unique within a project.

Deleting a branch

Use the -d flag with a branch name to delete it:
$ forest branch -d hotfix/fix-dropdown-issue
? Delete branch "hotfix/fix-dropdown-issue"? Y
 Branch hotfix/fix-dropdown-issue successfully deleted.
You will be prompted to confirm deletion. To skip the confirmation:
forest branch -d hotfix/fix-dropdown-issue --force

Examples

# List all branches
forest branch

# Create a new branch with a specific origin
forest branch feature/customer-export --origin production

# Create a branch in a specific project
forest branch feature/new-view --projectId 42

# Delete a branch
forest branch -d feature/old-experiment

# Delete a branch without confirmation
forest branch -d feature/old-experiment --force

# Output branch list as JSON
forest branch --format json