Skip to content

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

docs(merge): Clarify merge step details

Maximilian Roosa4a2862720b3
diff --git a/src/cli.rs b/src/cli.rs
index a9bea7b09..df1553856 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -566,8 +566,9 @@ The merge operation follows a strict order designed for fail-fast execution:
(defaults to repository's default branch).
2. Auto-commit uncommitted changes
- If working tree has uncommitted changes, stages all changes (git add -A) and commits
- with LLM-generated message.
+ If working tree has uncommitted changes, stages changes and commits with LLM-generated
+ message. By default stages all changes (git add -A). Use --tracked-only to stage only
+ tracked files (git add -u).
3. Squash commits (default)
By default, counts commits since merge base with target branch. When multiple
@@ -595,6 +596,18 @@ The merge operation follows a strict order designed for fail-fast execution:
Removes current worktree, deletes the branch, and switches main worktree to target
branch if needed. Skip removal with --no-remove.
+8. Run post-merge commands
+ Runs commands from project config's [post-merge-command] in the destination worktree
+ after cleanup. These receive {{ target }} placeholder. Commands run sequentially,
+ failures are logged but don't abort. Skip with --no-verify.
+
+HOOKS
+
+The --no-verify flag skips all project hooks:
+- Pre-commit hooks (before committing working tree changes)
+- Pre-merge hooks (after rebase, before push)
+- Post-merge hooks (after cleanup)
+
EXAMPLES
Basic merge to main:
@@ -606,7 +619,7 @@ Merge without squashing:
Keep worktree after merging:
wt merge --no-remove
-Skip pre-merge commands:
+Skip all hooks:
wt merge --no-verify"#)]
Merge {
/// Target branch (defaults to default branch)
@@ -625,7 +638,7 @@ Skip pre-merge commands:
#[arg(long = "no-remove", action = clap::ArgAction::SetFalse, default_value_t = true)]
remove: bool,
- /// Skip project hooks
+ /// Skip all project hooks
#[arg(long = "no-verify", action = clap::ArgAction::SetFalse, default_value_t = true)]
verify: bool,
diff --git a/tests/snapshots/integration__integration_tests__init__init_fish.snap b/tests/snapshots/integration__integration_tests__init__init_fish.snap
index 5ee307be6..83f70a328 100644
--- a/tests/snapshots/integration__integration_tests__init__init_fish.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_fish.snap
@@ -12,11 +12,10 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
- GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp5ZgirM/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpK4BFVd/test-config.toml
---
success: true
exit_code: 0
@@ -300,7 +299,7 @@ complete -c wt -n "__fish_wt_using_subcommand merge" -s C -d 'Change working dir
complete -c wt -n "__fish_wt_using_subcommand merge" -l no-squash -d 'Skip commit squashing'
complete -c wt -n "__fish_wt_using_subcommand merge" -l no-commit -d 'Skip commit, squash, and rebase'
complete -c wt -n "__fish_wt_using_subcommand merge" -l no-remove -d 'Keep worktree after merge'
-complete -c wt -n "__fish_wt_using_subcommand merge" -l no-verify -d 'Skip project hooks'
+complete -c wt -n "__fish_wt_using_subcommand merge" -l no-verify -d 'Skip all project hooks'
complete -c wt -n "__fish_wt_using_subcommand merge" -s f -l force -d 'Skip approval prompts'
complete -c wt -n "__fish_wt_using_subcommand merge" -l tracked-only -d 'Stage tracked files only'
complete -c wt -n "__fish_wt_using_subcommand merge" -s v -l verbose -d 'Show commands and debug info'
diff --git a/tests/snapshots/integration__integration_tests__init__init_zsh.snap b/tests/snapshots/integration__integration_tests__init__init_zsh.snap
index ea1c599a0..c5c92bb2b 100644
--- a/tests/snapshots/integration__integration_tests__init__init_zsh.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_zsh.snap
@@ -12,11 +12,10 @@ info:
GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
GIT_CONFIG_GLOBAL: /dev/null
GIT_CONFIG_SYSTEM: /dev/null
- GIT_EDITOR: ""
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpFxEupS/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpSJbP72/test-config.toml
---
success: true
exit_code: 0
@@ -454,7 +453,7 @@ _arguments "${_arguments_options[@]}" : \
'--no-squash[Skip commit squashing]' \
'--no-commit[Skip commit, squash, and rebase]' \
'--no-remove[Keep worktree after merge]' \
-'--no-verify[Skip project hooks]' \
+'--no-verify[Skip all project hooks]' \
'-f[Skip approval prompts]' \
'--force[Skip approval prompts]' \
'--tracked-only[Stage tracked files only]' \