List and clean up Git worktrees.

Adds age and pull request state to git worktree list. Review cleanup before removal.

Install with Homebrew

brew install filipgutica/tap/wtree

Homebrew installs Node.js. Optional: gh for PR state, fzf for wtree go. Install Homebrew if needed.

Runs on
macOS and Linux
Needs
Git and Node.js 20+

Current wtree UI; demo repository and sample pull requests.

Browse

wtree ui

Shortcuts sit above the table, with focused worktree details below it. [-] marks a worktree that cannot be removed.

Select

Space

Space selects a removable row. The selection count stays above the table, alongside d to review it.

Review

d

The plan lists what will go. Nothing is removed until you press y. b also deletes the branches.

List

wtree

The same data as a plain table. It ends with a hint when there is something to clean up.

Dry run

wtree clean --done --dry-run

Prints the cleanup plan for merged and closed pull requests. A dry run removes nothing.

Commands

Uses the current repository.

  • wtree

    List: main first, then oldest.

  • wtree ui

    Browse, filter, select, and remove worktrees.

  • wtree clean --done --dry-run

    Preview worktree removal for merged or closed PRs.

  • wtree new feat/example

    Create a branch's worktree or print its existing path.

  • wtree go

    Pick a worktree or branch; print its path.

  • wtree --size

    Measure disk usage with du; off by default.

  • wtree --json

    List as JSON.

Keys in wtree ui

? shows all shortcuts.

  • Space

    Select; blocked worktrees explain why they refuse.

  • Enter

    Full branch and path.

  • /

    Filter by branch or path.

  • d

    Review selected removals, then confirm.

  • o

    Exit; print the focused worktree's path.

  • n

    Create a branch's worktree.

Change directory

The wt wrapper changes your shell's directory.

  • eval "$(wtree shell-init zsh)"

    Add to ~/.zshrc; use bash for ~/.bashrc.

  • wt go

    Pick and change directory. Also: wt new, wt path, wt ui.

Good to know

Cleanup: review the plan, then confirm. --yes skips confirmation; --dry-run never removes. Branch deletion requires --delete-branch.

Protected: main and current worktrees are never removed. Dirty, unpushed, or locked worktrees require --force.

Unknown PR state stops filtered cleanup. Missing, signed-out, or offline gh makes wtree clean --done fail, rather than report no matches.

Without a terminal: clean, rm, and prune print the plan and exit 2 unless given --dry-run or --yes. wtree ui exits 2.

Also from Filip

Homebrew tap

  • annoterm

    Markdown review and agent feedback.

  • devps

    Local dev server management.

  • Workbench

    Tickets and agent threads across repositories.