wtcode
Effortlessly launch your favorite code tool in a git worktree.
worktree code / what-the-code -- streamlines git worktree selection, creation, and launching tools like Claude Code, lazygit, your editor, or any command.
Install
Homebrew
brew install netj/tap/wtcode
PyPI (via uv)
uv tool install wtcode
Or try it without installing:
uvx wtcode
Note:
uv tool installis recommended overuvxfor regular use.uvxkeeps a parentuv tool runprocess alive, which can interfere with tools like tmux that detect the working directory from the process tree.
From source
git clone https://github.com/netj/wtcode.git
ln -s "$PWD/wtcode/wtcode.sh" /usr/local/bin/wtcode
Usage
wtcode [BRANCH] [CMD [CMD-ARGS...]]
wtcode --exec CMD [CMD-ARGS...]
BRANCH-- Git branch or worktree name. If omitted and fzf is available, interactively select one. Surround with:to create a new branch (use:::nameorname:::to avoid fzf matching the colons).CMD-- Command to launch in the worktree. Defaults to$WTCODE_CMD, or the first available of:claude,aider,codex,$SHELL. WhenCMDresolves to plainclaude(no extra args) in a worktree that already existed, wtcode launchesclaude /resumeso it opens straight into your last session there. PressEscin the picker to start a new session instead.--exec-- Skip the branch argument; select interactively via fzf, then launchCMD.--help/--version-- Show help or version info.
Examples
wtcode feature-x # launch default tool in feature-x worktree
wtcode feature-x lazygit # launch lazygit
wtcode feature-x claude --resume # launch claude with flags
wtcode --exec claude --resume # select interactively, launch claude --resume
wtcode :new-feature # create new branch and worktree
wtcode # interactive branch selection via fzf
WTCODE_CMD=cursor wtcode feature # use cursor as default tool
Environment variables
| Variable | Description |
|---|---|
WTCODE_CMD |
Default tool to launch (e.g., claude, lazygit, vim, cursor) |
WTCODE_USE_CURRENT_BRANCH |
When creating a brand-new branch, fork it from the current HEAD instead of the default: origin/HEAD (falling back to origin/main, then origin/master) |
WTCODE_DEBUG |
Enable debug tracing when set to any value |
GIT_WORKTREE_ROOT |
Override the directory where worktrees are created |
How it works
- Select/specify a branch -- pass as argument or pick interactively with fzf
- Create or switch to the worktree -- worktrees are organized under
$GIT_WORKTREE_ROOT(defaults to../<repo>.worktrees/) - Provision Claude Code, if that's what you're launching -- when the resolved tool is
claude, the worktree is auto-trusted (skips the "do you trust this folder" dialog) and.claude/settings.json/.claude/settings.local.jsonare symlinked in from the main repo if not already present -- never for other tools, never clobbering a file that's already there - Launch the tool -- runs the specified command (or smart default) inside the worktree
Dependencies
- git -- required
- fzf -- recommended, for interactive branch selection
- jq -- optional, for Claude Code auto-trust setup (no dependency needed for the settings symlinking itself)
License
Metadata
Release files for wtcode 0.5.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 | |
|---|---|---|---|
| wtcode-0.5.0.tar.gz | 12.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wtcode-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.7 kB
Release files / wtcode-0.5.0.tar.gz
| Download URL | wtcode-0.5.0.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b0acee39bf90f1814de64bd49890166ac158cc0be48d18f938065acda63ba65b
|
|
BLAKE2b-256 checksum How to use checksums |
6e1c65e201c606e1fc45cdff32351a058bd8f1bca69bc2c7de2d0ec94925a9c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / wtcode-0.5.0-py3-none-any.whl
| Download URL | wtcode-0.5.0-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0cf6b25115c8b723d76b4c95a7488ab1b790bd9e52f90b364d1c6178d0828c3c
|
|
BLAKE2b-256 checksum How to use checksums |
3c133f2def15f78cb7274d68ec43f4c6d61cbd9f8e407cd5909b2974201c04b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|