wt remove
Remove worktree; delete branch if merged. For finished feature branches. Removes the current worktree by default.
Examples
Remove current worktree:
Remove specific worktrees:
Keep the branch:
Force-delete an unmerged branch:
Branch cleanup
By default, branches are deleted 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
⊂.
The 'same commit' check uses the local default branch; for other checks, 'target' means the default branch, or its upstream (e.g., origin/main) when strictly ahead.
Branches showing _ or ⊂ are dimmed as safe to delete.
Force flags
Worktrunk has two force flags for different situations:
| Flag | Scope | When to use |
|---|---|---|
--force (-f) | Worktree | Worktree has untracked files (build artifacts, IDE config) |
--force-delete (-D) | Branch | Branch has unmerged commits |
Without --force, removal fails if the worktree contains untracked files. Without -D, removal keeps branches with unmerged changes. Use --no-delete-branch to keep the branch regardless of merge status.
Background removal
Removal runs in the background by default (returns immediately). Logs are written to .git/wt-logs/{branch}-remove.log. Use --foreground to run in the foreground.
See also
Command reference
wt remove - Remove worktree; delete branch if merged
For finished feature branches. Removes the current worktree by default.
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
--foreground
Run removal in foreground (block until complete)
--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 debug info and write diagnostic report (-vv)