Skip to main content

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 install is recommended over uvx for regular use. uvx keeps a parent uv tool run process 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 :::name or name::: to avoid fzf matching the colons).
  • CMD -- Command to launch in the worktree. Defaults to $WTCODE_TOOL, or the first available of: claude, aider, codex, $SHELL. When CMD resolves to plain claude (no extra args) in a worktree that already existed, wtcode launches claude /resume so it opens straight into your last session there. Press Esc in the picker to start a new session instead.
  • --exec -- Skip the branch argument; select interactively via fzf, then launch CMD.
  • --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_TOOL=cursor wtcode feature  # use cursor as default tool

Environment variables

Variable Description
WTCODE_TOOL Default tool to launch (e.g., claude, lazygit, vim, cursor); WTCODE_CMD is a deprecated alias
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_BASE_REF Fork brand-new branches from this ref (also wtcode --base REF)
WTCODE_BRANCH_SCOPE Initial picker scope: all, worktree, local, remote
WTCODE_BRANCH_ORDER Initial picker order: recent, name, full (remote/name)
WTCODE_STATE_FILE Where the picker remembers its last state (default $XDG_STATE_HOME/wtcode/state; empty disables)
WTCODE_DEBUG Enable debug tracing when set to any value
GIT_WORKTREE_ROOT Override the directory where worktrees are created

How it works

  1. Select/specify a branch -- pass as argument or pick interactively with fzf
  2. Create or switch to the worktree -- worktrees are organized under $GIT_WORKTREE_ROOT (defaults to ../<repo>.worktrees/)
  3. 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.json are symlinked in from the main repo if not already present -- never for other tools, never clobbering a file that's already there
  4. 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

MIT

Metadata

Release files for wtcode 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wtcode 0.7.1
File Size Uploaded Provenance Actions
wtcode-0.7.1.tar.gz 21.0 kB Without provenance Details for wtcode-0.7.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wtcode 0.7.1
File Interpreter ABI Platform Actions
wtcode-0.7.1-py3-none-any.whl Python 3 none any Details for wtcode-0.7.1-py3-none-any.whl

Total release size: 41.0 kB

Release files / wtcode-0.7.1.tar.gz

Download URL wtcode-0.7.1.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2ff4008532293cdaad675dc5cabc4e7896635b810b0868f23a8c4104c4d15190
BLAKE2b-256 checksum
How to use checksums
741140cb5f7e2bae8fd35474cd4b4cc18c6bb3b657ebed1203d2e392152c0bc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","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.7.1-py3-none-any.whl

Download URL wtcode-0.7.1-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d2048b09ec8e77d0b90564a16aa8f8238e4d1a94d5ac9a634be0281a5b7d727
BLAKE2b-256 checksum
How to use checksums
3cb4f2cffbce54907d879cbc60d1d4930afc010940c52f78beb0dc416f034c38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","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}

Security for wtcode 0.7.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page