# pgbranch

> Git branching for your PostgreSQL database

Source: https://talira.ai/catalog/pgbranch-jr3991d7
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Command-line tool, Library
- Categories: [databases / branching](https://talira.ai/categories/databases/branching), [developer tools / testing](https://talira.ai/categories/developer-tools/testing)
- Platforms: linux, macos, cli
- Licence: MIT
- Pricing: Free and open source
- Free tier: yes
- Self-hostable: yes

pgbranch gives a local Postgres development database git-style branches: `pgbranch branch` snapshots the database as a template database, and `pgbranch checkout` drops the working database and recreates it from that snapshot, with no dump or restore. A git hook can switch the database when you check out a git branch. It also diffs schemas between branches, merges schema changes (beta), migrates a database by logical replication, and can be used as a Go library. Each snapshot is a full file-level copy, and one working database switches between branches rather than running them side by side.

## Links

- Website: https://pgbranch.dev
- GitHub: https://github.com/le-vlad/pgbranch

## Problems it solves

- I switch back to main and my database still has the feature branch's migrations applied
- switch my dev database automatically when I check out a git branch
- snapshot my local Postgres database and go back to it instantly
- dropping and re-seeding the dev database every time I change branches is slow
- compare the schema of two versions of my dev database
- keep one local database per git branch without remembering connection strings

## Features

- branch and checkout with template databases
- git hook for automatic switching
- schema diff
- schema merge (beta)
- migration by logical replication
- remotes
- usable as a Go library

## Capabilities

- Has a command line tool: plan not known
- Has official SDKs: plan not known

## Trust

Overall: 0.39 out of 1.
Signals: maintenance 0.64, adoption 0.45, momentum 0.36, community 0.24, backing 0.00, extensibility 0.20.

- last commit 23 days ago
- 6 commits in the last 90 days
- latest release v1.0.15 7 months ago
- 171 GitHub stars
- 3 contributors

## Alternatives

- [DBLab Engine](https://talira.ai/catalog/dblab-engine-egf8da3j.md): Blazing-fast PostgreSQL cloning and branching for dev/test environments and CI
- [dbfork](https://talira.ai/catalog/dbfork-94t857ss.md): Fast local PostgreSQL database branching for migrations, schema testing, and isolated development workflows
- [pgoverlay](https://talira.ai/catalog/pgoverlay-8z094v1s.md): Instant, writable copy-on-write branches of your real Postgres, self-hosted on plain Docker or Kubernetes. No ZFS required.
- [db-branch](https://talira.ai/catalog/db-branch-590ypapk.md): Instant database branches for MySQL and PostgreSQL, on your own servers
- [Xata](https://talira.ai/catalog/xata-gzxahrpc.md): Open source, cloud native, Postgres platform with copy-on-write branching and scale-to-zero
- [RiftDB](https://talira.ai/catalog/riftdb-dw0e3yr3.md): Instant, copy-on-write database branches for Postgres. Self-hosted. Every PR gets its own database.
