Skip to content

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

Fix switch docs: show directory change before hooks (#248)

Maximilian Roosd36645c79669
diff --git a/docs/content/switch.md b/docs/content/switch.md
index d3c7572e5..46d944510 100644
--- a/docs/content/switch.md
+++ b/docs/content/switch.md
@@ -26,8 +26,8 @@ For interactive selection, use [`wt select`](@/select.md).
When the target branch has no worktree, worktrunk:
1. Creates worktree at configured path
-2. Runs [post-create hooks](@/hook.md#post-create) (blocking)
-3. Switches to new directory
+2. Switches to new directory
+3. Runs [post-create hooks](@/hook.md#post-create) (blocking)
4. Spawns [post-start hooks](@/hook.md#post-start) (background)
The `--create` flag creates a new branch from the `--base` branch (defaults to default branch). Without `--create`, the branch must already exist.
diff --git a/src/cli.rs b/src/cli.rs
index 9e3eaeaa6..22a348311 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -2097,8 +2097,8 @@ For interactive selection, use [`wt select`](@/select.md).
When the target branch has no worktree, worktrunk:
1. Creates worktree at configured path
-2. Runs [post-create hooks](@/hook.md#post-create) (blocking)
-3. Switches to new directory
+2. Switches to new directory
+3. Runs [post-create hooks](@/hook.md#post-create) (blocking)
4. Spawns [post-start hooks](@/hook.md#post-start) (background)
The `--create` flag creates a new branch from the `--base` branch (defaults to default branch). Without `--create`, the branch must already exist.
diff --git a/tests/snapshots/integration__integration_tests__help__help_page_switch.snap b/tests/snapshots/integration__integration_tests__help__help_page_switch.snap
index 9e79c75d2..9d7498f9e 100644
--- a/tests/snapshots/integration__integration_tests__help__help_page_switch.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_page_switch.snap
@@ -35,8 +35,8 @@ For interactive selection, use [`wt select`](@/select.md).
When the target branch has no worktree, worktrunk:
1. Creates worktree at configured path
-2. Runs [post-create hooks](@/hook.md#post-create) (blocking)
-3. Switches to new directory
+2. Switches to new directory
+3. Runs [post-create hooks](@/hook.md#post-create) (blocking)
4. Spawns [post-start hooks](@/hook.md#post-start) (background)
The `--create` flag creates a new branch from the `--base` branch (defaults to default branch). Without `--create`, the branch must already exist.
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 70b66371d..0dda55286 100644
--- a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_switch_long.snap
@@ -86,8 +86,8 @@ For interactive selection, use wt select.
When the target branch has no worktree, worktrunk:
1. Creates worktree at configured path
-2. Runs post-create hooks (blocking)
-3. Switches to new directory
+2. Switches to new directory
+3. Runs post-create hooks (blocking)
4. Spawns post-start hooks (background)
The --create flag creates a new branch from the --base branch (defaults to default branch). Without --create, the branch must already exist.