wt remove

Removes worktrees and their branches. Without arguments, removes the current worktree and returns to the main worktree.

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

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

  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 .

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