wt switch
Two distinct operations:
- Switch to existing worktree — Changes directory, nothing else
- Create new worktree (
--create) — Creates branch and worktree, runs hooks
Examples
For interactive selection, use wt select.
Creating worktrees
With --create, worktrunk:
- Creates branch from
--base(defaults to default branch) - Creates worktree at configured path
- Runs post-create hooks (blocking)
- Switches to new directory
- Spawns post-start hooks (background)
Shortcuts
| Shortcut | Meaning |
|---|---|
^ | Default branch (main/master) |
@ | Current branch/worktree |
- | Previous worktree (like cd -) |
See also
- wt select — Interactive worktree selection
- wt list — View all worktrees
- wt remove — Delete worktrees when done
- wt merge — Integrate changes back to main
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