Skip to main content

db-git

CI Python License: MIT

Keep your database in sync with your Git branches.

db-git is a developer tool for schema migrations, seed data, experimental features, and branch switching during reviews. Its post-checkout hook keeps your local database aligned with the branch you are working on.

Documentation · Browse docs in GitHub · Release notes

Features

  • Automatic database handling on Git checkout.
  • Shared mode: save and restore branch-specific snapshots.
  • Per-branch mode: keep an independent database for each branch.
  • Launch applications and migrations with db-git run -- <command>.
  • Named checkpoints, history, and explicit retention in shared mode.
  • Git worktrees in per-branch mode.
  • Read-only diagnostics and recoverable database operations.
  • Checkout still completes if database handling fails, with recovery guidance.

Supported databases

Database Modes Strategy
PostgreSQL Shared and per-branch template or pgdump
MySQL 8.0 / 8.4 Shared and per-branch mysqldump
SQLite Per-branch Online backup

See the database guides for required privileges, client tools, and engine-specific limitations.

Quick start

Requires Python 3.12+, Git, and an existing local development database. For PostgreSQL:

uv tool install db-git # or pip install db-git

# Run inside your application's Git repository.
db-git init --database-url postgresql://localhost/myapp --mode per-branch

git checkout -b feature/auth
db-git run -- npm run dev # replace with your application's command

Install the hook during initialization. Your application must read DATABASE_URL; restart it through db-git run after switching branches. The default branch keeps the seed database, while other branches receive separate copies.

For MySQL, install uv tool install 'db-git[mysql]' and follow the MySQL guide. For SQLite, follow the SQLite guide.

Learn more

Contributing

See the development guide for dependencies and tests, and the documentation guide for local preview and publishing.

License

MIT

Release files for db-git 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for db-git 0.3.0
File Size Uploaded
db_git-0.3.0.tar.gz 210.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for db-git 0.3.0
File Interpreter ABI Platform
db_git-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 316.2 kB

Release files / db_git-0.3.0.tar.gz

Download URL db_git-0.3.0.tar.gz
Size 210.2 kB
Tags Source
SHA-256 checksum
How to use checksums
25dc00ca7ad66077e3d3715717bdd8a695350bbcd123ea8aed877485d96fcd83
BLAKE2b-256 checksum
How to use checksums
5bb84fcbc23e4c6633ba09db7e895a262df3624bee12f18065b1d0bd50189d75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release files / db_git-0.3.0-py3-none-any.whl

Download URL db_git-0.3.0-py3-none-any.whl
Size 106.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
32d6b9337cac037aaac1fd3ef2d305e0b405c918b2b7b1bc746b6a98ba15e92b
BLAKE2b-256 checksum
How to use checksums
ce57cbfdebe2733c3d2682606e5e5b1cd3edd1c0843616aec1e6aba0832a3e01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page