Search...
ctrl/
Light
Dark
System
Sign in

BranchesAdded in v5.0

Gel's branches are equivalent to PostgreSQL's databases and map to them directly. Gel comes with tooling to help manage branches and build a development workflow around them. E.g. when developing locally you can map your Gel branches to your Git branches, and when using Gel Cloud and GitHub you can have a branch per PR.

Refer to the gel branch command group for details on the CLI commands for managing branches.

These are low-level commands that are used to create, alter, and drop branches. You can use them when experimenting in REPL, of if you want to create your own tools to manage Gel branches.

Create a new branch without schema or data.

create empty branch name ;

The command create empty branch creates a new Gel branch without schema or data, aside from standard schemas.

Create a new empty branch:

Copy
create empty branch newbranch;

Create a new branch copying the schema (without data)of an existing branch.

create schema branch newbranch from oldbranch ;

The command create schema branch creates a new Gel branch with schema copied from an already existing branch.

Create a new schema branch:

Copy
create schema branch feature from main;

Create a new branch copying the schema and data of an existing branch.

create data branch newbranch from oldbranch ;

The command create data branch creates a new Gel branch with schema and data copied from an already existing branch.

Create a new data branch:

Copy
create data branch feature from main;

Remove a branch.

drop branch name ;

The command drop branch removes an existing branch. It cannot be executed while there are existing connections to the target branch.

Executing drop branch removes data permanently and cannot be undone.

Remove a branch:

Copy
drop branch appdb;

Rename a branch.

alter branch oldname rename to newname ;

The command alter branch … rename changes the name of an existing branch. It cannot be executed while there are existing connections to the target branch.

Rename a branch:

Copy
alter branch featuer rename to feature;