Skip to content

BruceMacD/wt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wt - Git Worktree Manager

An interactive Git worktree manager powered by fzf. Create, switch, and clean up worktrees without remembering any git worktree commands.

Note: This tool is optimized for and tested on macOS only.

Install

cargo install fzf-worktree
worktree alias

Add the printed alias to your shell config (~/.bashrc, ~/.zshrc, etc.):

wt() {
    case "$1" in
        list|remove|rm|prefix|alias|help|-h|--help)
            worktree "$@"
            ;;
        *)
            case "$2" in
                -h|--help) worktree "$@" ;;
                *)
                    local dir
                    dir="$(worktree "$@")" || return
                    [ -z "$dir" ] || cd "$dir"
                    ;;
            esac
            ;;
    esac
}

Building from source

git clone https://github.com/brucemacd/wt.git
cd wt
cargo build --release
cp target/release/worktree ~/.local/bin/

Commands

Command Description
wt Open interactive picker — select an existing worktree or type a new branch name
wt add <name> Create or switch to a worktree by name without opening the picker
wt new <name> Create or switch to a worktree by name
wt exit Return to the main repo directory (alias: wt x)
wt list List branches and paths for the current project's worktrees
wt remove <name> Delete a worktree (alias: wt rm)
wt prefix "feature/" Set a prefix applied to all new branch names
wt prefix Show the current prefix
wt prefix "" Clear the prefix

How it works

  1. Run wt inside any Git repo
  2. An fzf picker shows your existing worktrees, including detached worktrees created by Codex
    • When available, Codex worktrees include the associated chat title from Codex's local metadata
    • If that metadata can't be read, they fall back to a stable codex/<id> label
  3. Select one to switch, or type a new branch name and press Enter
  4. New worktrees are created at ~/.wt/<repo>/<branch>/

Example workflow

# Start a feature
wt                        # type "feature-xyz", press Enter
# ... write code ...
git push -u origin feature-xyz
gh pr create

# Switch context
wt                        # pick another worktree

# Cleanup after merge
wt exit
wt remove feature-xyz

Development

# Build and install locally
cargo install --path .

# Build without installing (binary at target/debug/worktree)
cargo build

# Run directly without installing
cargo run -- [command]

After rebuilding, run cargo install --path . to update the installed binary.

About

Git worktree manager with fzf integration

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages