git-wt

Enhanced Git worktree management with interactive features

View the Project on GitHub ahmedelgabri/git-wt

git-wt logo

git-wt

A Git custom command that enhances Git’s native worktree functionality with interactive features, automation, and repository migration capabilities.

git-wt uses a bare repository structure where the git data lives in a .bare directory and each branch gets its own worktree directory.

Why Git Worktrees?

Git worktrees allow you to have multiple branches checked out simultaneously in different directories:

Features

Quick Start

Installation

Homebrew:

brew tap ahmedelgabri/git-wt
brew install git-wt

Nix Flakes:

nix run github:ahmedelgabri/git-wt

Manual:

Download a prebuilt binary from the releases page:

curl -sL https://github.com/ahmedelgabri/git-wt/releases/latest/download/git-wt-VERSION-OS-ARCH.tar.gz | tar xz
cp git-wt-VERSION-OS-ARCH/git-wt ~/.local/bin/

Basic Usage

# Clone with worktree structure
git wt clone https://github.com/user/repo.git

# Migrate existing repo (experimental)
git wt migrate

# Create new worktree (interactive)
git wt add

# Switch between worktrees
cd $(git wt switch)

# Remove worktree
git wt remove feature-branch

Repository Structure

When you clone with git wt clone, you get:

repo/
├── .bare/          # Git data (bare repository)
├── .git            # Points to .bare
└── main/           # Worktree for default branch

Commands

Command Description
clone <url> Clone repo with worktree structure
migrate Convert existing repo to worktree structure (experimental)
add [options] ... Create new worktree (supports all git worktree flags)
remove [worktree] Remove worktree and local branch
destroy [worktree] Remove worktree and delete local + remote branches
update Fetch all and update default branch
switch Interactive worktree selection

All native git worktree commands (list, lock, unlock, move, prune, repair) are also supported as pass-through.

Dependencies

License

MIT


View on GitHub