The npkill of git worktrees

Find and clean stale git worktree entries across all your repos. Interactive TUI for humans. JSON output for AI agents. Single static binary, ~5 MB, MIT licensed.

$ brew install ohernandezdev/tap/wtkill
wtkill demo

Why

Worktrees are great until you forget them. Six months in you have 60 GB of branches you'll never touch again, scattered across .worktrees/, .claude/worktrees/, and one-offs you made on a Tuesday. git worktree list only shows them per-repo. du on ~/Projects lies to you because of symlinks.

wtkill walks your projects directory, runs git worktree list --porcelain on every repo it finds, enriches each entry with du -sk and git log -1, and renders the whole picture sorted by what's eating the most disk.

Features

Recursive scan

Walk any directory looking for git repos. 8 worktrees enriched concurrently via goroutines. Results stream into the UI live.

Symlink-aware dedupe

Repos that share a .git via symlink only show their worktrees once. No phantom duplicates.

Charmbracelet TUI

Bubble Tea + Lip Gloss. Spinner, age-coloured rows, prunable/missing/failed badges, in-place delete with status feedback.

AI-agent friendly

Off-TTY output is JSON by default. list, rm, clean subcommands with structured results and proper exit codes.

Safe by default

clean without filters refuses to run. --dry-run previews. --force is opt-in.

Single binary

~5 MB, no runtime, no dependencies. darwin-arm64, linux-amd64, linux-arm64 prebuilt. Build from source for the rest.

How to use it

As a human

# open the TUI on your projects directory
wtkill

# or scan somewhere else, deeper
wtkill --path ~/code --depth 6

Arrow keys to navigate, space to delete, f to toggle --force, r to rescan, q to quit.

As an AI agent or script

# JSON list of every worktree (auto-JSON off-TTY)
wtkill list --json

# Bulk-clean: preview what 60-day-old branches would be removed
wtkill clean --older-than 60d --dry-run

# Filter by branch name regex + size
wtkill list --branch '^claude/' --min-size 100MB

# Remove specific paths
wtkill rm /path/to/worktree --force --json

Exit codes: 0 success 1 partial fail 2 bad usage

What it is not