Development environments
Create isolated environments for developers or feature work without copying the entire database.
Neon · Const
Neon database branching creates isolated copy-on-write clones of a database for development, testing, CI/CD, or recovery. A branch can start from the current or a retained historical state and then diverges independently.
A Neon branch is an isolated copy-on-write clone of a database. It starts from a current or historical state of a parent branch, shares the parent’s underlying data initially, and records later writes independently as changes.
neon branches create --name <branch-name> --parent <parent-branch>| Name | Type | Description |
|---|---|---|
--name | string | Name of the new branch; the CLI can generate a default name if omitted. |
--parent | string | Existing branch from which schema and data are inherited. |
past state | timestamp | Optional historical point from which to create the branch, when supported by the selected interface. |
A new isolated Neon database branch with the selected parent state and its own connection string.
neon branches create --name feature-x --parent mainCreates an isolated branch named feature-x from the main branch using the Neon CLI.
Create isolated environments for developers or feature work without copying the entire database.
Run destructive DELETE, UPDATE, or DDL queries against production-like data safely.
Create parallel, disposable database environments for automated pipelines.
Reconstruct data from a retained historical point for investigation or recovery.
A branch is a copy-on-write clone of a Neon database. It inherits the parent’s schema and data at a selected point, then stores subsequent changes separately.
Follow-up: Why is creation fast? The branch initially references shared underlying data and writes only deltas instead of copying the whole database.
Branches are isolated: changes made in one do not affect its parent or other branches. Each branch can therefore serve as an independent development, testing, or CI environment.
Follow-up: How can production data be tested safely? Create a branch from the production state, run destructive or schema-changing queries there, and remove the branch afterward.
A branch can be created from the parent’s current state or from a past state within the available history. The selected parent supplies the schema and data baseline for the new branch.
Follow-up: What happens if the requested historical point is unavailable? The parent must retain that history, so creation from that point cannot proceed when it has expired.
BranchParent branchRoot branchCopy-on-writeSnapshotsRestore windowneon branches create