db-git
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
- Choose shared or per-branch mode
- Run applications and migrations
- Work with Git worktrees
- Save checkpoints and inspect history
- Command reference
- Configuration
- Troubleshooting
- Recovery
Contributing
See the development guide for dependencies and tests, and the documentation guide for local preview and publishing.
License
Metadata
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| db_git-0.3.0.tar.gz | 210.2 kB | With provenance | Details for db_git-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| db_git-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for db_git-0.3.0-py3-none-any.whl |
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 logRelease 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 logSecurity for db-git 0.3.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for db_git-0.3.0.tar.gz
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 logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.