git-wt

Fast, reliable git worktree management

Language
Zig
Version
0.6.2
License
MIT
Category
Dev Tool

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

01

Create worktrees with automatic branch creation and config copying

02

Remove worktrees safely with multi-select support and branch cleanup

03

Interactive navigation between worktrees sorted by modification time

04

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

05

Clean stale worktrees for branches deleted from remote

06

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

07

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

08

Nested subdirectories for branch names with slashes

09

JSON, plain text, and detailed list output formats

10

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

11

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.

01 · 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.

02 · Reload your shell

>_
$ source ~/.zshrc

03 · 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