Skip to main content

Launch your favorite code tool in a git worktree

Project description

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_CMD, or the first available of: claude, aider, codex, $SHELL.
  • --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_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_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. Launch a 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

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wtcode-0.1.4.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wtcode-0.1.4-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file wtcode-0.1.4.tar.gz.

File metadata

  • Download URL: wtcode-0.1.4.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","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}

File hashes

Hashes for wtcode-0.1.4.tar.gz
Algorithm Hash digest
SHA256 a2828036a092578860f8e44f22b5b8c2e5fe354eb6cc79c276ada329e3430a5b
MD5 ee9b9bc01fa06b5ec0f167b14a9657d1
BLAKE2b-256 e09e5707aabb2e1d7c8e013e525c250d382ad7980e86b6642157dfea75d3ad6b

See more details on using hashes here.

File details

Details for the file wtcode-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: wtcode-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","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}

File hashes

Hashes for wtcode-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 713753a3918f4426135841b5d7d909064ef84c81f3beecc55b9fd7ec9f1aa128
MD5 57c793f30a957c7d4d68883454fc887f
BLAKE2b-256 3ef83b8a4b390ead37b961062dde5617750d98aa217262fd96189442f1e2bcc4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page