Node.js Developer Guide
Other documentationsDemoCommunityGitHub
  • Forest Admin
  • Getting started
    • How it works
    • Quick start
    • Install
      • Create your agent
      • Expose an HTTP endpoint
        • For standalone agents
        • On Express
        • On Koa
        • On Fastify
        • On NestJS
      • Autocompletion & Typings
      • Troubleshooting
    • Migrating legacy agents
      • What's new
      • Pre-requisites
      • Recommendations
      • Migration steps
        • Run new agent in parallel
        • Configure database connection
        • Code transformations
          • API Charts
          • Live Queries
          • Smart Charts
          • Route overrides
          • Smart Actions
          • Smart Fields
          • Smart Relationships
          • Smart Segments
        • Compare schemas
        • Swap agents
      • Post-migration
        • Dropping Sequelize
        • Optimize your agent
  • Data Sources
    • Getting Started
      • Collection selection
      • Naming conflicts
      • Cross-data source relationships
      • Query interface and Native Queries
        • Fields and projections
        • Filters
        • Aggregations
    • Provided data sources
      • SQL (without ORM)
      • Sequelize
      • Mongoose
      • MongoDB
    • Write your own
      • Replication strategy
        • Persistent cache
        • Updating the replica
          • Scheduled rebuilds
          • Change polling
          • Push & Webhooks
        • Schema & References
        • Write handlers
      • Translation strategy
        • Structure declaration
        • Capabilities declaration
        • Read implementation
        • Write implementation
        • Intra-data source Relationships
      • Contribute
  • Agent customization
    • Getting Started
    • Actions
      • Scope and context
      • Result builder
      • Static Forms
      • Widgets in Forms
      • Dynamic Forms
      • Form layout customization
      • Related data invalidation
    • Charts
      • Value
      • Objective
      • Percentage
      • Distribution
      • Leaderboard
      • Time-based
    • Fields
      • Add fields
      • Move, rename and remove fields
      • Override binary field mode
      • Override writing behavior
      • Override filtering behavior
      • Override sorting behavior
      • Validation
    • Hooks
      • Collection hook
      • Collection override
    • Pagination
    • Plugins
      • Provided plugins
        • AWS S3
        • Advanced Export
        • Flattener
      • Write your own
    • Relationships
      • To a single record
      • To multiple records
      • Computed foreign keys
      • Under the hood
    • Search
    • Segments
  • Frontend customization
    • Smart Charts
      • Create a table chart
      • Create a bar chart
      • Create a cohort chart
      • Create a density map
    • Smart Views
      • Create a Map view
      • Create a Calendar view
      • Create a Shipping view
      • Create a Gallery view
      • Create a custom tinder-like validation view
      • Create a custom moderation view
  • Deploying to production
    • Environments
      • Deploy on AWS
      • Deploy on Heroku
      • Deploy on GCP
      • Deploy on Ubuntu
      • Deploy on Azure
    • Development workflow
    • Using branches
    • Deploying your changes
    • Forest Admin CLI commands
      • init
      • login
      • branch
      • switch
      • set-origin
      • push
      • environments:create
      • environments:reset
      • deploy
  • Under the hood
    • .forestadmin-schema.json
    • Data Model
      • Typing
      • Relationships
    • Security & Privacy
Powered by GitBook
On this page

Was this helpful?

  1. Deploying to production
  2. Forest Admin CLI commands

branch

PreviousloginNextswitch

Last updated 1 year ago

Was this helpful?

This is the official documentation of the @forestadmin/agent Node.js agent.

The forest branch command is at the center of what your Forest Admin development workflow should look like. As explained on , it allows you to manage your layouts, a bit like you would use git's branches for your code.

$ forest branch --help
Create a new branch or list your existing branches.

USAGE
  $ forest branch [BRANCH_NAME]

ARGUMENTS
  BRANCH_NAME  The name of the branch to create.

OPTIONS
  -d, --delete            Delete the branch.
  -f, --format=table|json [default: table] Output format.
  -o, --origin=origin     Set the origin of the created branch.
  --force                 When deleting a branch, skip confirmation.
  --help                  Display usage information.
  --projectId=projectId   The id of the project to create a branch in.

Here are a few extra details on how it works.

The forest branch command has 3 uses, depending on how you use it:

  • list branches,

  • create branches,

  • delete branches.

Listing existing branches

To list your existing branches, run forest branch:

$ 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 indicates your currently selected branch: your Development Environment layouts will be displayed according to this branch's layout configuration.

Creating a new branch

To create a new branch, append the name of the branch you wish to create after forest branch, like so:

$ forest branch feature/new-ops-feature --origin production
✅ Switched to new branch: feature/new-ops-feature

There is no specific constraint on branch names, though kebab-case is generally used.

However, keep in mind that your branch name must be unique in the project.

Note that your project must be deployed remotely before you can start using branches:

$ forest branch add-refund-action
❌ You cannot create a branch until this project has either a remote or a production environment.

Deleting a branch

To delete a branch, use the -d option and a branch name to the forest branch command:

$ 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 for confirmation before deleting a branch. To skip that confirmation, use the --force option.

Any branch reflects layout changes (i.e. configuration changes in your UI) that you've made on that branch. To make this possible, a branch needs an origin, which is the state of the layout you started from and made these layout changes on. This is why you need to (ideally) or simply a Remote Environment: those Environments can serve as the origin of your branches.

this page
have a Production Environment