Prerequisites
- Flipt v2
- A GitHub Account and a repository to sync to (Optional).
Using Branches for Environments
Flipt v2 allows you to branch existing environments. This is useful if you want to test changes to your feature flags and configurations in a separate branch without affecting your users in production.Branch Storage
By default, environments and their branches are stored in memory. This means that if you restart Flipt, the data will be lost. You can configure Flipt to store your environments and branches in a Git repository on your local machine. See the Storage documentation for more information. You can also configure Flipt to sync your environments and branches to a remote Git repository. This is useful if you want to share your environments and branches with your team or if you want to backup your data. See the Git Sync guide for more information.Creating a Branch
To create a branch simply click the branch button in the top right of the Flipt UI.You cannot branch from a branched environment. You can only branch from
‘source’ environments that are configured in your Flipt configuration file.


Branch names must be unique within the source environment. They also cannot be
the same as the source environment.
Create
button. This will create a new branch with the same data as the source environment and update the UI to show the new branch.

Any changes you make to the branch will not affect the source environment and
vice versa.
Navigating With Branches
You can navigate between environments and branched environments by clicking the environment selector in the top left of the Flipt UI.
Deleting a Branch
In a branched environment, you can see the source environment that the branch is based on in the top right of the Flipt UI.

Delete Branch
button to delete the branch.
This will delete the branch and update the UI to show the source environment.
Deleting a branch will not delete the data from the source environment.
Evaluation With Branches
Since branches are just environments themselves, you can evaluate within them just like you would evaluate any other environment using our UI, API or SDKs.Review the Evaluation documentation for more
information on how evaluation works.
In the UI
You can evaluate a flag in a branch by selecting the branch in the environment selector and then selecting the flag you want to evaluate. Next click theView in Playground
button to open the playground for that flag in the branched environment.


Using the API/SDKs
All of our SDKs support evaluating within environments and branches. See the SDKs documentation for more information. In this example we’ll use the Go Client Side SDK to evaluate a flag in a branch. Imagine that you have a branch calledtest
and you want to evaluate a flag called test-flag
in that branch. You can do the following:
Using GitHub for Git Sync
If you’ve configured Flipt to use a GitHub repository for Git Sync, your branches will also be synced to your GitHub repository. See the Git Sync guide for more information on how to configure Flipt to use a GitHub repository for Git Sync.Flipt v2 supports any Git provider including Gitea, GitLab, Bitbucket, Azure
DevOps, and is not limited to GitHub.
View Remote
option in the branch info menu.

