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.mdindex 499507d07..f37f563a4 100644--- a/docs/content/switch.md+++ b/docs/content/switch.md@@ -36,18 +36,6 @@ wt switch ^ # Main worktreewt 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 WorktreesWith `--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 selectiondiff --git a/src/cli.rs b/src/cli.rsindex 6da463bd8..c9c2a358d 100644--- a/src/cli.rs+++ b/src/cli.rs@@ -1007,18 +1007,6 @@ wt switch ^ # Main worktreewt 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 WorktreesWith `--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 selectiondiff --git a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap b/tests/snapshots/integration__integration_tests__help__help_switch_long.snapindex 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 [[2mwt select[0m](/select/).[2mwt switch ^ # Main worktree[0m[2mwt switch --create fix --base=@ # Branch from current HEAD[0m-[32mPath-First Lookup[0m--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--[1mEdge case[0m: If [2mrepo.foo/[0m exists but tracks branch [2mbar[0m:-- [2mwt switch foo[0m → switches to [2mrepo.foo/[0m (the [2mbar[0m worktree)-- [2mwt switch bar[0m → also works (branch lookup finds same worktree)-[32mCreating Worktrees[0mWith [2m--create[0m, worktrunk:@@ -110,6 +98,18 @@ With [2m--create[0m, worktrunk:[2mwt switch --create docs --execute "code ."[0m[2mwt switch --create temp --no-verify # Skip hooks[0m+[32mPath-First Lookup[0m++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++[1mEdge case[0m: If [2mrepo.foo/[0m exists but tracks branch [2mbar[0m:+- [2mwt switch foo[0m → switches to [2mrepo.foo/[0m (the [2mbar[0m worktree)+- [2mwt switch bar[0m → also works (branch lookup finds same worktree)+[32mSee Also[0m- [wt select](/select/) — Interactive worktree selection