Skip to content

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

Move Path-First Lookup section to bottom of wt switch docs (#86)

Maximilian Roos3de4c561d532
diff --git a/docs/content/switch.md b/docs/content/switch.md
index 499507d07..f37f563a4 100644
--- a/docs/content/switch.md
+++ b/docs/content/switch.md
@@ -36,18 +36,6 @@ wt switch ^ # Main worktree
wt switch --create fix --base=@ # Branch from current HEAD
```
-## Path-First Lookup
-
-Arguments resolve by checking the filesystem before git branches:
-
-1. Compute expected path from argument (using configured path template)
-2. If worktree exists at that path, switch to it
-3. Otherwise, treat argument as branch name
-
-**Edge case**: If `repo.foo/` exists but tracks branch `bar`:
-- `wt switch foo` → switches to `repo.foo/` (the `bar` worktree)
-- `wt switch bar` → also works (branch lookup finds same worktree)
-
## Creating Worktrees
With `--create`, worktrunk:
@@ -65,6 +53,18 @@ wt switch --create docs --execute "code ."
wt switch --create temp --no-verify # Skip hooks
```
+## Path-First Lookup
+
+Arguments resolve by checking the filesystem before git branches:
+
+1. Compute expected path from argument (using configured path template)
+2. If worktree exists at that path, switch to it
+3. Otherwise, treat argument as branch name
+
+**Edge case**: If `repo.foo/` exists but tracks branch `bar`:
+- `wt switch foo` → switches to `repo.foo/` (the `bar` worktree)
+- `wt switch bar` → also works (branch lookup finds same worktree)
+
## See Also
- [wt select](/select/) — Interactive worktree selection
diff --git a/src/cli.rs b/src/cli.rs
index 6da463bd8..c9c2a358d 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -1007,18 +1007,6 @@ wt switch ^ # Main worktree
wt switch --create fix --base=@ # Branch from current HEAD
```
-## Path-First Lookup
-
-Arguments resolve by checking the filesystem before git branches:
-
-1. Compute expected path from argument (using configured path template)
-2. If worktree exists at that path, switch to it
-3. Otherwise, treat argument as branch name
-
-**Edge case**: If `repo.foo/` exists but tracks branch `bar`:
-- `wt switch foo` → switches to `repo.foo/` (the `bar` worktree)
-- `wt switch bar` → also works (branch lookup finds same worktree)
-
## Creating Worktrees
With `--create`, worktrunk:
@@ -1036,6 +1024,18 @@ wt switch --create docs --execute "code ."
wt switch --create temp --no-verify # Skip hooks
```
+## Path-First Lookup
+
+Arguments resolve by checking the filesystem before git branches:
+
+1. Compute expected path from argument (using configured path template)
+2. If worktree exists at that path, switch to it
+3. Otherwise, treat argument as branch name
+
+**Edge case**: If `repo.foo/` exists but tracks branch `bar`:
+- `wt switch foo` → switches to `repo.foo/` (the `bar` worktree)
+- `wt switch bar` → also works (branch lookup finds same worktree)
+
## See Also
- [wt select](/select/) — Interactive worktree selection
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 b2bdb692e..946ac0008 100644
--- a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
@@ -83,18 +83,6 @@ For interactive selection, use [wt select](/select/).
wt switch ^ # Main worktree
wt switch --create fix --base=@ # Branch from current HEAD
-Path-First Lookup
-
-Arguments resolve by checking the filesystem before git branches:
-
-1. Compute expected path from argument (using configured path template)
-2. If worktree exists at that path, switch to it
-3. Otherwise, treat argument as branch name
-
-Edge case: If repo.foo/ exists but tracks branch bar:
-- wt switch foo → switches to repo.foo/ (the bar worktree)
-- wt switch bar → also works (branch lookup finds same worktree)
-
Creating Worktrees
With --create, worktrunk:
@@ -110,6 +98,18 @@ With --create, worktrunk:
wt switch --create docs --execute "code ."
wt switch --create temp --no-verify # Skip hooks
+Path-First Lookup
+
+Arguments resolve by checking the filesystem before git branches:
+
+1. Compute expected path from argument (using configured path template)
+2. If worktree exists at that path, switch to it
+3. Otherwise, treat argument as branch name
+
+Edge case: If repo.foo/ exists but tracks branch bar:
+- wt switch foo → switches to repo.foo/ (the bar worktree)
+- wt switch bar → also works (branch lookup finds same worktree)
+
See Also
- [wt select](/select/) — Interactive worktree selection