wt remove

Remove worktree; delete branch if merged. For finished feature branches. Removes the current worktree by default.

Examples

Remove current worktree:

wt remove

Remove specific worktrees:

wt remove feature-branch
wt remove old-feature another-branch

Keep the branch:

wt remove --no-delete-branch feature-branch

Force-delete an unmerged branch:

wt remove -D experimental

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):

  1. Same commit — Branch HEAD equals the default branch. Shows _ in wt list.
  2. Ancestor — Branch is in target's history (fast-forward or rebase case). Shows .
  3. No added changes — Three-dot diff (target...branch) is empty. Shows .
  4. Trees match — Branch tree SHA equals target tree SHA. Shows .
  5. 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:

FlagScopeWhen to use
--force (-f)WorktreeWorktree has untracked files (build artifacts, IDE config)
--force-delete (-D)BranchBranch has unmerged commits
wt remove feature --force       # Remove worktree with untracked files
wt remove feature -D            # Delete unmerged branch
wt remove feature --force -D    # Both

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)