wt remove
Removes worktrees and their branches. Without arguments, removes the current worktree and returns to the main worktree.
Examples
Remove current worktree:
Remove specific worktrees:
Keep the branch:
Force-delete an unmerged branch:
Branch cleanup
Branches delete automatically when merging them would add nothing. This works with squash-merge and rebase workflows where commit history differs but file changes match.
Worktrunk checks five conditions (in order of cost):
- Same commit — Branch HEAD equals the default branch. Shows
_inwt list. - Ancestor — Branch is in target's history (fast-forward or rebase case). Shows
⊂. - No added changes — Three-dot diff (
target...branch) is empty. Shows⊂. - Trees match — Branch tree SHA equals target tree SHA. Shows
⊂. - Merge adds nothing — Simulated merge produces the same tree as target. Handles squash-merged branches where target has advanced. Shows
⊂.
Check 1 compares against the default branch. Checks 2-5 compare against target — the default branch, or its upstream (for example, origin/main) when it's strictly ahead (catching branches merged remotely before pulling).
Branches showing _ or ⊂ are dimmed as safe to delete.
Use -D to force-delete branches with unmerged changes. Use --no-delete-branch to keep the branch regardless of status.
Background removal
Removal runs in the background by default (returns immediately). Logs are written to .git/wt-logs/{branch}-remove.log. Use --no-background to run in the foreground.
Shortcuts
@ (current), - (previous), ^ (default branch). See wt switch.
See also
Command reference
wt remove - Remove worktree and branch
Usage: wt remove [OPTIONS] [BRANCHES]...
Arguments:
[BRANCHES]...
Branch name [default: current]
Options:
--no-delete-branch
Keep branch after removal
-D, --force-delete
Delete unmerged branches
--no-background
Run removal in foreground
--no-verify
Skip hooks
-y, --yes
Skip approval prompts
-f, --force
Force worktree removal
Remove worktrees even if they contain untracked files (like build
artifacts). Without this flag, removal fails if untracked files exist.
-h, --help
Print help (see a summary with '-h')
Global Options:
-C <path>
Working directory for this command
--config <path>
User config file path
-v, --verbose
Show commands and debug info