lopper

Find stale Git worktrees across all your repositories, see their disk usage and status, and clean up the ones you no longer need.

install

curl -fsSL https://lopper.dev/install.sh | sh
irm https://lopper.dev/install.ps1 | iex
go install github.com/shinokamix/lopper/apps/lopper/cmd/lopper@latest

why lopper

Worktrees pile up all over the disk. You make some by hand, and coding agents make one per task, each tool in its own folder. Every worktree has its own node_modules, .venv or target/, and can take up gigabytes.

Git lists them one repository at a time, and you have to check each one yourself before deleting it. lopper finds them all and shows each one's size and status, so you know what's safe to delete.

lopper is not a worktree manager: it does not create or switch worktrees. It scans your home and temporary folders, or the folders you name, and finds orphaned, moved and damaged worktrees too. It sees work merged by squash, rebase or cherry-pick, and refuses a worktree whose index flags hide edits from Git.

commands

lopper                     # open the terminal UI
lopper ~/code              # scan a specific directory
lopper scan --json         # print scan results as JSON
lopper scan --safe --paths # print paths of worktrees safe to delete
lopper rm ../wt            # remove a worktree if safe
lopper rm --all-safe ~/wt  # remove every safe worktree under ~/wt
lopper update              # update to the latest release

faq

When is a worktree safe?

When Git tracks it where it is, it is not locked, git status is clean, no index flag hides edits, and its commits are in the base branch, even after a squash or rebase. The base is origin/HEAD, main or master as of your last fetch. A check that could not run counts as failed. Ignored files, such as .env, are not checked and are deleted with the worktree.

Can it delete unfinished work?

Only when you ask it to. lopper rm refuses a worktree that is not safe unless you pass --force. In the TUI, d lists such worktrees under "removal may lose work", and confirming removes them anyway. The branch is always kept.

How does removal work?

lopper checks the worktree again right before removing it, in case it changed since the scan. Then it runs git worktree remove, which deletes the folder and Git's record of it but keeps the branch. There is no trash, so the folder is gone for good.

Where does it look?

Everywhere under your home and temp folders, hidden ones too. lopper doesn't look for specific tools, so it finds worktrees from Claude Code, Codex, Cursor, T3 Code, Orca, Paseo or whatever comes next.

Does it go online?

Only to check GitHub for updates. LOPPER_NO_UPDATE_CHECK=1 turns that off.