git-wt

Fast, reliable git worktree management

Zig v0.6.1 MIT
View on GitHub

A CLI tool for managing git worktrees with automatic setup, configuration copying, and interactive navigation. It automates branch creation, safely removes worktrees with cleanup, and syncs configuration files across worktrees.

Preview

Features

Create worktrees with automatic branch creation and config copying

Remove worktrees safely with multi-select support and branch cleanup

Interactive navigation between worktrees sorted by modification time

Auto-syncs .env, .claude, CLAUDE.local.md, and .ai-cache to new worktrees (customizable via config)

Clean stale worktrees for branches deleted from remote

User-level and project-level configuration (.git-wt.toml)

Shell alias generation with configurable file descriptor (fd3 by default)

Nested subdirectories for branch names with slashes

JSON, plain text, and detailed list output formats

Bare mode — works without shell alias, outputs paths for copy-paste or piping

Zero runtime dependencies (except git)

Install

Homebrew

$ brew install shhac/tap/git-wt

GitHub Release (macOS)

$ curl -L https://github.com/shhac/git-wt/releases/latest/download/git-wt-macos-universal.tar.gz | tar xz

Build from Source

$ git clone https://github.com/shhac/git-wt.git && cd git-wt && zig build -Doptimize=ReleaseFast

Getting Started

CLI tools run as subprocesses and can't change your shell's working directory. The gwt shell alias wraps git-wt with a file descriptor mechanism so that commands like new and go actually navigate your shell to the worktree.

1. Add the alias to your shell config

$ echo 'eval "$(git-wt alias gwt)"' >> ~/.zshrc

For bash, use ~/.bashrc instead. You can replace gwt with any name you prefer.

2. Reload your shell

$ source ~/.zshrc

3. Use gwt for all commands

gwt new and gwt go will change your shell's directory. Other commands like list and clean pass through unchanged.

Usage

Create a worktree with nested branch
$ gwt new feature/auth-system
Interactive worktree navigation
$ gwt go
Multi-select removal
$ gwt rm
List worktrees as JSON
$ gwt list --json
Preview stale worktree cleanup
$ gwt clean --dry-run