A delightful git worktree manager — spin up isolated branch workspaces with one command, run per-project setup automatically, and jump straight into a ready-to-code shell.
bunx wbaum open feature/login
# or
npx wbaum open feature/loginThat's it. wbaum creates a git worktree based on your current branch, runs any setup commands you've defined, and drops you into a shell inside the new workspace. Exit the shell to come back — your original checkout is untouched.
Git worktrees are one of the most underused superpowers in git. They let you check out multiple branches at the same time, each in its own directory, sharing the same .git — no stash juggling, no "let me just commit this wip" dance. But using them raw is clunky: you have to pick a path, remember to install dependencies, copy .env files, and then manually cd in.
wbaum turns worktrees into a first-class workflow:
- 🌳 One command to go —
wbaum open <branch>creates the worktree, runs setup, and drops you in. - ⚙️ Zero-config, config-optional — add a
.wbaum.yamland setup (install, link env files, seed DBs) runs automatically every time. - 🧘 Stays out of your way — all worktrees live under
.worktrees/, auto-added to.gitignore, never polluting your main checkout. - 🧹 Clean teardown —
wbaum rm <branch>removes the worktree and the branch in one step. - 🪄 Zero install — works through
bunxandnpx. No global install needed. - 🎨 Cool, simple TUI — colorful output, spinners, clean tables. No noise, no ceremony.
Perfect for: reviewing PRs, testing risky refactors in parallel, running multiple dev servers on different branches, AI coding agents that need isolated scratch spaces, monorepos with heavy install steps.
You don't have to. Just run it:
bunx wbaum open my-branch
npx wbaum open my-branchOr install globally:
npm i -g wbaum
pnpm add -g wbaum
bun add -g wbaumRequires Node 18+ and a working git in your $PATH.
From anywhere inside your git repo:
wbaum open feature/loginThis will:
- Create a new branch
feature/loginbased on the current branch. - Add a git worktree at
./.worktrees/feature/login. - Append
.worktrees/to.gitignore(once, if missing). - Run every command in
.wbaum.yaml'ssetup:list inside the new worktree. - Launch your
$SHELLin that directory so you can start working immediately.
When you're done, just exit the shell. You're back where you started.
Optional, lives at the repo root. The only thing it needs is a setup: list of shell commands — they run sequentially in the fresh worktree:
setup:
- pnpm install
- cp ../../.env .env
- pnpm db:migrateInside each command you get two environment variables:
| Variable | What it is |
|---|---|
$WBAUM_BRANCH |
The branch name you opened |
$WBAUM_WORKTREE |
The absolute path to the worktree |
That's the entire config schema. It's meant to stay small.
wbaum open <branch> [--from <base>] [--no-setup] [--no-shell]
wbaum list
wbaum cd <branch>
wbaum remove <branch> [--force] [--keep-branch]
wbaum prune [--dry-run] [--force] [--keep-branches]
wbaum --help | --version
Create (or re-enter) a worktree and launch a shell in it.
| Flag | Effect |
|---|---|
--from <b> |
Base the new branch on <b> instead of the current branch |
--no-setup |
Skip .wbaum.yaml setup commands |
--no-shell |
Don't spawn a subshell; in non-TTY mode prints the worktree path to stdout |
Aliases: wbaum enter, wbaum cd for existing worktrees.
If the branch already exists locally, wbaum attaches to it. If the worktree already exists, wbaum skips creation and just enters it.
Show every wbaum-managed worktree with branch, HEAD, path, and lock status.
Enter an existing worktree in a subshell. In a TTY, spawns $SHELL. In a non-TTY context, prints the path — handy for shell integrations:
cd "$(wbaum cd my-branch)"Remove the worktree and delete the branch. Flags:
--force— force-remove a dirty worktree and force-delete an unmerged branch--keep-branch— remove only the worktree, keep the branch around
Removes worktrees whose branches have been merged into the default branch, deletes those branches, and then runs git worktree prune -v to clean up stale administrative records.
Detects both regular merges (strict ancestor) and squash/rebase merges (the branch's cumulative patch is already upstream — the typical GitHub "Squash and merge" workflow). The default branch is resolved from origin/HEAD, falling back to a local or remote main/master. Locked worktrees and the default-branch worktree itself are never touched.
Flags:
--dry-run(-n) — list what would be removed without changing anything--force(-f) — force-remove dirty worktrees and force-delete branches--keep-branches— remove the worktrees but keep the merged branches around
Because wbaum runs in its own process, it can't change your parent shell's directory. That's why it spawns a subshell — it's the most robust cross-shell solution and works identically in bash, zsh, fish, and PowerShell.
If you'd rather change directory in-place, add this to your .bashrc / .zshrc:
wb() {
if [ "$1" = "cd" ] || [ "$1" = "open" ]; then
local path
path="$(command wbaum "$@" --no-shell --no-setup 2>/dev/null)"
[ -n "$path" ] && cd "$path"
else
command wbaum "$@"
fi
}Then wb cd feature/login cd's you in directly.
git worktree add: the primitive wbaum wraps. wbaum adds convention (a predictable location), automation (setup commands), ergonomics (TUI, cleanup, defaults), and discoverability (list,rm).git-branchless,gh worktree,wt: more powerful, more opinions. wbaum intentionally does one thing.- Direnv / Nix shells: complementary. Put
direnv allowin your.wbaum.yamlsetup list and they compose.
git clone https://github.com/runwisp/wbaum
cd wbaum
npm install
npm test
node bin/wbaum.js --helpContributions welcome — the whole tool is a few hundred lines of plain ES modules with minimal dependencies (picocolors, yaml).
GPL-3.0-or-later © runwisp contributors