Docs
Core Concepts

Branches

Copy-on-write snapshot forks that let you branch a database like Git.

A branch is a copy-on-write fork of a database. Because a Silos database is defined by its snapshots and WAL in object storage, forking it doesn't copy the data — it creates a new branch that shares the parent's underlying state and only diverges as you write to it. That makes a branch cheap to create and cheap to throw away.

Why branches

Branches give you a full, isolated database for short-lived work without standing up a new server:

Preview environments

Branch a database for every pull request, deploy against it, and delete it when the PR merges.

Test isolation

Run a test suite against a branch so it can mutate data freely without touching production.

Experiments

Try a migration or a risky change on a branch first, then apply it to the parent.

Per-tenant or per-task forks

Spin up an isolated branch for a tenant or an agent task, then tear it down.

Create a branch

Terminal
silos branch create feature-x

You can list, inspect, and delete branches with the rest of the silos branch commands.

Connect to a branch

Each branch gets its own endpoint. The host encodes the branch name with a -- separator:

postgres://user:password@db-xxxx--feature-x.silos.sh/main?sslmode=require

So pointing a preview deployment or a test run at a branch is just a matter of swapping the host in your connection string. Everything else — drivers, ORMs, SQL — is identical.

How copy-on-write works

When you create a branch, Silos records a new entry in the database's branch DAG that points at the parent's current snapshot. Reads on the branch resolve against shared state; writes append new WAL that belongs only to the branch. The parent is never affected by changes on a child branch, and creating a branch doesn't duplicate the parent's data.

Branching builds on the same snapshot + WAL storage that powers the rest of Silos. See Snapshots & WAL for how that durable state is structured.

Next steps

On this page