Disposable local Postgres branches

Clone a development database in seconds, not minutes.

dbfork uses PostgreSQL's native CREATE DATABASE ... TEMPLATE path to create local database branches fast enough for daily development, migration testing, schema diffing, and feature-isolated workflows.

PostgreSQL templates migration safety schema diff local-first

dbfork

1 to 3 seconds

Server-side template clone, built for repeated use during active development.

pg_dump | pg_restore

2 to 5 minutes

Good for backup-style workflows, too slow for every migration and feature branch.

$ dbfork create feature_migration
created feature_migration from postgres_dev

$ dbfork diff feature_migration
tables changed: 3
columns added: 5
indexes changed: 1

Why dbfork

The missing branch workflow for local Postgres development.

Feature branches for code are normal. Feature branches for the local database usually are not, which is why migration testing and schema experiments still fall back to slow dump and restore loops. dbfork closes that gap with a workflow that feels instant enough to use every day.

Server-side clone path

PostgreSQL duplicates the database on disk instead of streaming rows through a client process, which is why the branching loop feels fast.

Safe migration testing

Give a migration its own disposable branch, run the change, inspect the result, and drop the branch when the experiment is over.

Schema diff workflow

Compare the branch against the source database before merge so drift and accidental changes show up before they become shared state.

No extra infrastructure

No hosted service, no storage layer, and no heavy multi-container branch system. If you already have local Postgres, you already have the primitive.

Speed story

Use the local database like code, not like a fragile shared pet.

The public benchmark framing in the repo is the right mental model: for a 1 GB development database, dump and restore usually takes minutes, while template cloning typically finishes in a few seconds on the same machine.

Branch fast enough to use it daily

The performance win matters because developers only keep a branch workflow when it feels as disposable as a git branch.

Inspect before merge

Compare the branch against the source database, review drift, and only keep the experiment when the schema change is real.

Install

Branch, test, inspect, drop.

dbfork is most convincing when you can try it against your existing local instance immediately. The page keeps the install and first-use path short on purpose.

go install github.com/Meru143/dbfork/cmd/dbfork@latest

dbfork create feature_migration
dbfork diff feature_migration
dbfork drop feature_migration --force
Use it for:

- migration rehearsals
- schema experiments
- isolated feature branches
- branch-vs-source diffing