Skip to main content

Developer-first git worktree workflow CLI

Project description

workthreads

workthreads provides the wt CLI: a developer-first workflow tool for creating, preparing, listing, and deleting git worktrees.

Setup

Prerequisites:

  • Git
  • Python 3.12+

Install the latest release from PyPI:

uv tool install workthreads
wt --help

Alternative user-level install without uv-managed tools:

python3 -m pip install --user workthreads
wt --help

For local development, install uv and sync dependencies:

uv sync

Run the CLI from the repo during development:

uv run wt --help

Install the local checkout once so it is available globally on your PATH and you do not need to use uv run every time:

uv tool install -e .
wt --help

Shell setup

Full shell integration includes completion, wt add --cd, and wt cd support:

eval "$(wt shell init zsh)"   # zsh
eval "$(wt shell init bash)"  # bash
wt shell init fish | source   # fish

Completion only:

eval "$(wt shell completion zsh)"

Basic usage

Configure wt defaults for this repo:

wt config init
wt config edit

Repo configuration lives in wt.toml at the repository root. It can stay untracked for local workflow settings, or be committed only when the repo intentionally wants shared defaults. Use wt config path to print the active path.

By default, wt add feature/payment-retry creates .worktrees/feature/payment-retry under the repo root. When the selected base ref belongs to a configured remote, wt add fetches that remote first; pass --no-fetch to skip this for one command.

Recommended local workflow:

[defaults]
fetch = true
copyLocal = true
deleteBranch = false

[shell]
cdAfterAdd = true

Keep copyLocal = false if you do not want local ignored and untracked files copied automatically. Enable it when fresh worktrees usually need local setup files such as .env, editor config, generated credentials, or scratch project config before the app can run.

Create a worktree:

wt add feature/payment-retry

Create one at an exact path and copy ignored/untracked local files:

wt add feature/payment-retry \
  --base origin/main \
  --path ../external-worktrees/payment-retry \
  --copy-local

Full shell integration enters newly created worktrees by default. To stay in the current directory for one command:

wt add feature/payment-retry --no-cd

Jump to an existing worktree when shell integration is enabled:

wt cd payment-retry

wt cd accepts exact names and unique prefixes. For a worktree named feat/foo, both wt cd feat and wt cd foo can resolve it when unique. If fzf is installed, unresolved or ambiguous queries open a filtered picker instead of silently choosing a fuzzy match.

List worktrees:

wt list

Delete the current linked worktree:

wt delete

Delete a named worktree from elsewhere:

wt delete feature/payment-retry

Hooks

Configure lifecycle hooks:

wt hooks init
wt hooks edit post-create

Hooks receive stable WT_* environment variables such as WT_EVENT, WT_REPO_ROOT, WT_WORKTREE_PATH, WT_BRANCH, and WT_BASE.

Recommended repo-local hook script layout:

.git/
  workthreads/
    hooks/
      post-create.sh
      pre-delete.sh

Use wt hooks dir or wt hooks path post-create to inspect the generated paths.

User-global hook scripts are also fine:

~/.config/
  workthreads/
    hooks/
      post-create.sh
      pre-delete.sh

Shared hook scripts are possible, but should be intentional project policy rather than the default:

scripts/
  wt/
    post-create.sh
    pre-delete.sh

Development

Run tests:

uv run pytest

Run a quick CLI smoke check:

uv run wt
uv run wt shell completion zsh

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

workthreads-0.1.0.tar.gz (39.1 kB view details)

Uploaded Source

Built Distribution

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

workthreads-0.1.0-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file workthreads-0.1.0.tar.gz.

File metadata

  • Download URL: workthreads-0.1.0.tar.gz
  • Upload date:
  • Size: 39.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for workthreads-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ad50420c04c387d00c42ad572cb1b01cfc358e3a5eeb5454fabda7bfc8408a27
MD5 940feee70f36fc60a29978ada61d8f96
BLAKE2b-256 2aae870237e22ecba848ee5dc401ed90b5bf0d4a6b372f54f63d63181cf6bff8

See more details on using hashes here.

Provenance

The following attestation bundles were made for workthreads-0.1.0.tar.gz:

Publisher: publish.yml on kaiix/workthreads

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file workthreads-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: workthreads-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for workthreads-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc9744782dfbb6a0fe4b3063b5005e2ab433cc2779fbe784791c46085769ad84
MD5 18b2ee3666ade284d621fb7878ed9c54
BLAKE2b-256 c7e5869265b11e204cbb2b61d36e0a51c61dc159b2031b6e2971eeb9a0dbbc66

See more details on using hashes here.

Provenance

The following attestation bundles were made for workthreads-0.1.0-py3-none-any.whl:

Publisher: publish.yml on kaiix/workthreads

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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