wt switch

Two distinct operations:

Examples

wt switch feature-auth           # Switch to existing worktree
wt switch -                      # Previous worktree (like cd -)
wt switch --create new-feature   # Create branch and worktree
wt switch --create hotfix --base production

For interactive selection, use wt select.

Creating worktrees

With --create, worktrunk:

  1. Creates branch from --base (defaults to default branch)
  2. Creates worktree at configured path
  3. Runs post-create hooks (blocking)
  4. Switches to new directory
  5. Spawns post-start hooks (background)
wt switch --create api-refactor
wt switch --create fix --base release-2.0
wt switch --create docs --execute "code ."
wt switch --create temp --no-verify      # Skip hooks

Shortcuts

ShortcutMeaning
^Default branch (main/master)
@Current branch/worktree
-Previous worktree (like cd -)
wt switch -                      # Back to previous
wt switch ^                      # Main worktree
wt switch --create fix --base=@  # Branch from current HEAD

See also


Command reference

wt switch - Switch to a worktree
Usage: wt switch [OPTIONS] <BRANCH>

Arguments:
  <BRANCH>
          Branch or worktree name

          Shortcuts: '^' (main), '-' (previous), '@' (current)

Options:
  -c, --create
          Create a new branch

  -b, --base <BASE>
          Base branch

          Defaults to default branch.

  -x, --execute <EXECUTE>
          Command to run after switch

          Replaces the wt process with the command after switching, giving it full terminal control. Useful for launching editors, AI agents, or other interactive tools.

          Especially useful in shell aliases to create a worktree and start working in one command:

            alias wsc='wt switch --create --execute=claude'

          Then wsc feature-branch creates the worktree and launches Claude Code.

  -f, --force
          Skip approval prompts

      --no-verify
          Skip all project hooks

  -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