A small Rust CLI for managing git worktrees next to the current repository.
The binary is wt. It creates managed worktrees in a sibling directory named
../<repo>-worktrees/<name> and remembers per-worktree open roots under that
managed directory.
- Create git worktrees with matching branch names by default.
- List managed worktrees, or all linked worktrees.
- Open a worktree in
cmux, optionally pinned or with a custom title. - Run commands inside a selected worktree.
- Save and reuse a per-worktree subdirectory root.
- Merge a worktree branch back and clean up the worktree.
- Delete managed worktrees and optionally delete their branches.
From this repository:
cargo install --path . --forceOr during development:
cargo build
cargo run -- listwt open and the default wt create flow use cmux to open workspaces. Use wt create --no-open, wt open --command ..., or wt path <target> if you only need paths/commands.
Install the shell wrapper so wt open <target> can cd your current shell into the worktree instead of opening cmux:
# zsh/bash
source <(wt init)To make it permanent, add that line to your shell rc file.
wt <COMMAND>Commands:
wt init— print shell integration.wt create <name>— create../<repo>-worktrees/<name>.wt list— list managed worktrees.wt open <target>— open a worktree incmuxor run a command in it.wt merge <target>— merge a managed worktree branch and remove it.wt delete <target>— remove a managed worktree.wt path <target>— print the resolved worktree path (hidden command, used by shell integration).
A target can be a worktree name, branch name, or path.
Create a worktree and branch named feature-login, then open it in cmux:
wt create feature-loginCreate from a specific base without opening it:
wt create feature-login --base origin/main --no-openCreate a worktree with a different branch name:
wt create login-ui --branch feature/login-uiReuse an existing branch:
wt create hotfix --branch hotfix/issue-123 --existingExisting branches are only reused when --existing is passed; otherwise wt create fails instead of silently checking out that branch.
List managed worktrees:
wt listInclude the main worktree and unmanaged linked worktrees:
wt list --allOpen a worktree:
wt open feature-loginRun a command inside a worktree:
wt open feature-login --command "cargo test"Open a saved or explicit subdirectory root:
wt create docs-update --root docs
wt open docs-update
wt open docs-update --root crates/apiMerge a worktree branch into the current main-worktree branch and remove the worktree:
wt merge feature-loginMerge into a specific destination branch and keep the source branch:
wt merge feature-login --into main --keep-branchDelete a managed worktree:
wt delete feature-loginForce-delete a dirty worktree and delete its branch:
wt delete feature-login --force --delete-branchCommon tasks are available through just:
just build
just test
just fmt
just check
just install
just releaseThe main entrypoint is src/main.rs.
wtmust be run from inside a git repository or one of its worktrees.- Managed worktrees are protected:
mergeanddeleterefuse unmanaged worktrees. mergechecks for dirty source/destination worktrees before merging.- If a merge conflict or dirty worktree is detected,
wtcan offer to spawn an agent incmuxwhenpiorclaudeis installed.