Skip to content

Your first clean

cloudranger edited this page Nov 14, 2026 · 1 revision

1. Preview it

zap clean --all --dry-run
zap clean --all --dry-run: three worktrees to zap in ~/dev/my-app, one kept in ~/dev/api

A ✓ marks what would go, and WHAT says what happens to it: remove the worktree, and delete its branch when the branch's work is already in main. A · marks what zap keeps, with the reason. Nothing changes during a dry run.

2. The one-time disclaimer

The first time you clean on a machine, zap explains what it will and won't do and asks you to type zap:

The disclaimer: what zap removes, where, the safety checks, backups and what can't be restored

3. Clean

zap clean
zap clean asks for confirmation, then zaps three worktrees and shows the backup refs

zap shows the same table as the dry run and asks [y/N]. zap runs the checks again right before removing each worktree. If you saved a file in one since the preview, zap keeps it.

Each deleted branch gets a backup ref, shown on its line. zap clean works on the repository you're in; add --all for every opted-in repository.

To pick worktrees by hand, run zap with no command to open the picker.

What you can't get back

Undo restores branches and worktrees. It can't restore files git ignores, such as node_modules, .venv and build output, because git never had a copy. Reinstall or rebuild them as usual.

Next: Undo

Clone this wiki locally