Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Improve wt switch help text clarity (#192)

Maximilian Roos72720178d1e2
diff --git a/docs/content/switch.md b/docs/content/switch.md
index 385e2d835..016cb9fb4 100644
--- a/docs/content/switch.md
+++ b/docs/content/switch.md
@@ -8,17 +8,16 @@ group = "Commands"
<!-- ⚠️ AUTO-GENERATED from `wt switch --help-page` — edit cli.rs to update -->
-Two distinct operations:
+Switches to a worktree, creating one if needed.
-- **Switch to existing worktree** — Changes directory, nothing else
-- **Create new worktree** (`--create`) — Creates branch and worktree, runs [hooks](@/hook.md)
+With `--create`, creates a new branch based off `--base` (defaults to default branch) and runs [hooks](@/hook.md).
## Examples
```bash
-wt switch feature-auth # Switch to existing worktree
+wt switch feature-auth # Switch to worktree
wt switch - # Previous worktree (like cd -)
-wt switch --create new-feature # Create branch and worktree
+wt switch --create new-feature # Create new branch and worktree
wt switch --create hotfix --base production
```
diff --git a/src/cli.rs b/src/cli.rs
index 7b3270f92..b74679b97 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -2009,17 +2009,16 @@ wt list --format=json | jq '.[] | select(.main_state == "integrated" or .main_st
},
/// Switch to a worktree
- #[command(after_long_help = r#"Two distinct operations:
+ #[command(after_long_help = r#"Switches to a worktree, creating one if needed.
-- **Switch to existing worktree** — Changes directory, nothing else
-- **Create new worktree** (`--create`) — Creates branch and worktree, runs [hooks](@/hook.md)
+With `--create`, creates a new branch based off `--base` (defaults to default branch) and runs [hooks](@/hook.md).
## Examples
```console
-wt switch feature-auth # Switch to existing worktree
+wt switch feature-auth # Switch to worktree
wt switch - # Previous worktree (like cd -)
-wt switch --create new-feature # Create branch and worktree
+wt switch --create new-feature # Create new branch and worktree
wt switch --create hotfix --base production
```
diff --git a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap b/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
index fda407314..2143b6184 100644
--- a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
@@ -67,16 +67,15 @@ Usage: wt switch [OPTIONS] <BRANCH>
-v, --verbose
Show commands and debug info
-Two distinct operations:
+Switches to a worktree, creating one if needed.
-- Switch to existing worktree — Changes directory, nothing else
-- Create new worktree (--create) — Creates branch and worktree, runs hooks
+With --create, creates a new branch based off --base (defaults to default branch) and runs hooks.
Examples
- wt switch feature-auth # Switch to existing worktree
+ wt switch feature-auth # Switch to worktree
wt switch - # Previous worktree (like cd -)
- wt switch --create new-feature # Create branch and worktree
+ wt switch --create new-feature # Create new branch and worktree
wt switch --create hotfix --base production
For interactive selection, use `wt select`.