3 releases

Uses new Rust 2024

new 0.1.2 Feb 10, 2026
0.1.1 Feb 6, 2026
0.1.0 Feb 6, 2026

#1535 in Command line utilities

CC0 license

37KB
825 lines

wt

build codecov

wt is a tool to help you manage your git worktrees.

Installation

wt should run on any unix-based system, including Linux, MacOS, and the BSDs.

The easiest way to install it is by using cargo, the Rust package manager:

cargo install wt-cli

Otherwise, see below for the complete package list:

Cross-platform

Package Manager Package Command
Cargo wt-cli cargo install wt-cli
Homebrew terror/tap/wt brew install terror/tap/wt

Pre-built binaries

Pre-built binaries for Linux and MacOS can be found on the releases page.

Usage

wt is designed to be very simple to use. We expose a minimal set of subcommands that let you interact with your worktrees:

Usage: wt <COMMAND>

Commands:
  convert  Convert existing branches to worktrees
  create   Create a new worktree
  init     Generate shell integration
  list     List all worktrees
  remove   Remove worktrees
  switch   Switch to a different worktree
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Shell Integration

To enable shell integration, add the following to your .zshrc:

eval "$(wt init zsh)"

This defines a wt shell function that wraps the wt binary. When you run convert, create, remove, or switch, the shell function automatically cds into the resulting worktree directory and executes any configured hooks.

Hooks

wt supports hooks that run after switching to a worktree. Hooks are configured in the wt config file (typically ~/.config/wt/config.toml):

[[hooks.post_worktree_change]]
command = "direnv reload"

[[hooks.post_worktree_change]]
command = "nvm use"
only_if = ".nvmrc"

Each post_worktree_change entry has:

  • command — The shell command to run after changing worktrees.
  • only_if (optional) — A glob pattern evaluated relative to the worktree root. The hook only runs if the pattern matches at least one file.

Prior Art

I was inspired to build this after using worktrunk. I wanted a more minimal set of features with a more powerful fuzzy-search engine built in.

Dependencies

~29–46MB
~730K SLoC