Show HN: Wtdb – give every Git worktree its own database
Copy databases and update environment variables when spawning new git worktrees. - willhackett/wtdb
Opening excerpt (first ~120 words) tap to expand
wtdb Give every git worktree its own database. The problem You use git worktree to work on several branches at once. But every worktree points at the same local dev database. The moment one branch runs a migration, it changes the schema the others rely on — so concurrent branches with diverging migrations step on each other. A fresh worktree is also missing everything git ignores: your .env / .dev.vars, your node_modules. So it isn't even runnable until you copy things across by hand. What wtdb does When you create a worktree, wtdb automatically: Copies your dev database into a new one named after the worktree (Postgres, via a near-instant CREATE DATABASE ... TEMPLATE). Copies your env file into the worktree and rewrites the database URL to point at the new database.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at GitHub.