Skip to content

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

docs: Explain reasons for auto-deleting worktrees

Maximilian Roos34fa3b07ca47
diff --git a/CLAUDE.md b/CLAUDE.md
index 0e30216a7..e26c7ec50 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -147,9 +147,13 @@ Use consistent punctuation and structure for related messages:
**Parallel structure:** Related messages should follow the same pattern:
```rust
-// ✅ GOOD - parallel structure distinguishes user choice from system decision
-"Removing feature worktree & branch in background" // Merged (will delete)
-"Removing feature worktree in background; retaining unmerged branch" // Unmerged (system keeps)
+// ✅ GOOD - parallel structure distinguishes context and integration reason
+// After wt merge: show integration reason with target in parentheses
+"Removing feature worktree & branch in background (ancestor of main)" // Traditional merge (ancestor)
+"Removing feature worktree & branch in background (contents match main)" // Squash/rebase (tree SHA matches)
+// Explicit wt remove: no parenthetical needed, user requested it
+"Removing feature worktree & branch in background" // Explicit remove
+"Removing feature worktree in background; retaining unmerged branch" // Unmerged (system keeps)
"Removing feature worktree in background; retaining branch (--no-delete-branch)" // User flag (user keeps)
```
diff --git a/README.md b/README.md
index 9f5d5cff8..3043e5f55 100644
--- a/README.md
+++ b/README.md
@@ -68,7 +68,7 @@ $ wt merge
auth.rs | 13 +++++++++++++
1 file changed, 13 insertions(+)
✅ Merged to main (1 commit, 1 file, +13)
-🔄 Removing fix-auth worktree & branch in background
+🔄 Removing fix-auth worktree & branch in background (ancestor of main)
```
<!-- END AUTO-GENERATED -->
@@ -204,7 +204,7 @@ test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fin
jwt.rs | 8 ++++++++
3 files changed, 33 insertions(+)
✅ Merged to main (1 commit, 3 files, +33)
-🔄 Removing feature-auth worktree & branch in background
+🔄 Removing feature-auth worktree & branch in background (ancestor of main)
🔄 Running post-merge install:
cargo install --path .
Installing worktrunk v0.1.0
@@ -298,7 +298,7 @@ All checks passed!
tests/test_auth.py | 14 ++++++++++++++
2 files changed, 45 insertions(+)
✅ Merged to main (1 commit, 2 files, +45)
-🔄 Removing feature-auth worktree & branch in background
+🔄 Removing feature-auth worktree & branch in background (ancestor of main)
```
<!-- END AUTO-GENERATED -->
diff --git a/src/output/handlers.rs b/src/output/handlers.rs
index af0dd8b50..4d46494d0 100644
--- a/src/output/handlers.rs
+++ b/src/output/handlers.rs
@@ -45,42 +45,67 @@ fn format_switch_success_message(
}
}
+/// Why a branch is considered integrated into the target.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+enum IntegrationReason {
+ /// Branch is an ancestor of target (traditional merge)
+ Merged,
+ /// Branch's tree SHA matches target's tree SHA (squash merge/rebase)
+ ContentsMatch,
+}
+
/// Check if a branch's content has been integrated into the target.
///
-/// Returns true if the branch is safe to delete because either:
-/// - The branch is an ancestor of the target (traditional merge), OR
-/// - The branch's tree SHA matches the target's tree SHA (squash merge/rebase)
+/// Returns the reason if the branch is safe to delete:
+/// - `Merged`: The branch is an ancestor of the target (traditional merge)
+/// - `ContentsMatch`: The branch's tree SHA matches the target's tree SHA (squash merge/rebase)
///
-/// Returns false if neither condition is met, or if an error occurs (e.g., invalid refs).
+/// Returns None if neither condition is met, or if an error occurs (e.g., invalid refs).
/// This fail-safe default prevents accidental branch deletion when integration cannot
/// be determined.
-fn is_branch_integrated(repo: &Repository, branch_name: &str, target: &str) -> bool {
+fn get_integration_reason(
+ repo: &Repository,
+ branch_name: &str,
+ target: &str,
+) -> Option<IntegrationReason> {
// Check traditional merge relationship
if repo.is_ancestor(branch_name, target).unwrap_or(false) {
- return true;
+ return Some(IntegrationReason::Merged);
}
// Check if tree content matches (handles squash merge/rebase)
- repo.trees_match(branch_name, target).unwrap_or(false)
+ if repo.trees_match(branch_name, target).unwrap_or(false) {
+ return Some(IntegrationReason::ContentsMatch);
+ }
+
+ None
}
/// Attempt to delete a branch if it's integrated or force_delete is set.
///
/// Returns:
-/// - `Ok(true)` if branch was deleted
-/// - `Ok(false)` if branch was not deleted (not integrated, and not force)
+/// - `Ok(Some(reason))` if branch was deleted due to integration
+/// - `Ok(Some(None))` if branch was force-deleted (no integration reason)
+/// - `Ok(None)` if branch was not deleted (not integrated and not forced)
/// - `Err` if git command failed
+///
+/// The outer Option indicates whether deletion occurred; the inner Option
+/// indicates the integration reason (None when force-deleted).
fn delete_branch_if_safe(
repo: &Repository,
branch_name: &str,
target: &str,
force_delete: bool,
-) -> anyhow::Result<bool> {
- if !force_delete && !is_branch_integrated(repo, branch_name, target) {
- return Ok(false);
+) -> anyhow::Result<Option<Option<IntegrationReason>>> {
+ let reason = get_integration_reason(repo, branch_name, target);
+
+ // Delete if integrated or force-delete requested
+ if reason.is_none() && !force_delete {
+ return Ok(None); // Not integrated and not forced - don't delete
}
+
repo.run_command(&["branch", "-D", branch_name])?;
- Ok(true)
+ Ok(Some(reason)) // Deleted: Some(Some(reason)) if integrated, Some(None) if forced
}
/// Handle the result of a branch deletion attempt.
@@ -88,15 +113,15 @@ fn delete_branch_if_safe(
/// Shows appropriate warnings for non-deleted branches.
///
/// Returns:
-/// - `Ok(true)` if branch was deleted
-/// - `Ok(false)` if branch was not deleted (warning shown)
+/// - `Ok(Some(reason))` if branch was deleted (reason is None if force-deleted)
+/// - `Ok(None)` if branch was not deleted (warning shown)
fn handle_branch_deletion_result(
- result: anyhow::Result<bool>,
+ result: anyhow::Result<Option<Option<IntegrationReason>>>,
branch_name: &str,
-) -> anyhow::Result<bool> {
+) -> anyhow::Result<Option<Option<IntegrationReason>>> {
match result {
- Ok(true) => Ok(true),
- Ok(false) => {
+ Ok(Some(reason)) => Ok(Some(reason)), // Deleted (with or without integration reason)
+ Ok(None) => {
// Branch not integrated - show warning
super::warning(cformat!(
"<yellow>Could not delete branch <bold>{branch_name}</></>"
@@ -106,7 +131,7 @@ fn handle_branch_deletion_result(
"",
None,
))?;
- Ok(false)
+ Ok(None)
}
Err(e) => {
// Git command failed - show warning with error details
@@ -114,25 +139,43 @@ fn handle_branch_deletion_result(
"<yellow>Could not delete branch <bold>{branch_name}</></>"
))?;
super::gutter(format_with_gutter(&e.to_string(), "", None))?;
- Ok(false)
+ Ok(None)
}
}
}
/// Get flag acknowledgment note for remove messages
-fn get_flag_note(no_delete_branch: bool, force_delete: bool, branch_deleted: bool) -> &'static str {
+///
+/// `deletion_result`: None = not deleted, Some(None) = force-deleted, Some(Some(reason)) = integrated
+/// `target_branch`: The branch we checked integration against (shown in reason)
+fn get_flag_note(
+ no_delete_branch: bool,
+ force_delete: bool,
+ deletion_result: Option<Option<IntegrationReason>>,
+ target_branch: Option<&str>,
+) -> String {
if no_delete_branch {
- " (--no-delete-branch)"
- } else if force_delete && branch_deleted {
- " (--force-delete)"
+ " (--no-delete-branch)".to_string()
+ } else if force_delete && deletion_result.is_some() {
+ " (--force-delete)".to_string()
+ } else if let Some(target) = target_branch {
+ // After wt merge: show specific integration reason with target
+ match deletion_result {
+ Some(Some(IntegrationReason::Merged)) => format!(" (ancestor of {target})"),
+ Some(Some(IntegrationReason::ContentsMatch)) => format!(" (contents match {target})"),
+ Some(None) | None => String::new(),
+ }
} else {
- ""
+ // Explicit wt remove: no reason needed, user requested it
+ String::new()
}
}
/// Format message for remove worktree operation (includes emoji and color for consistency)
///
-/// `branch_deleted` indicates whether branch deletion actually succeeded (not just attempted)
+/// `deletion_result`: None = not deleted, Some(None) = force-deleted, Some(Some(reason)) = integrated
+/// `target_branch`: The branch we checked integration against (Some = merge context, None = explicit remove)
+#[allow(clippy::too_many_arguments)]
fn format_remove_worktree_message(
main_path: &std::path::Path,
changed_directory: bool,
@@ -140,17 +183,23 @@ fn format_remove_worktree_message(
branch: Option<&str>,
no_delete_branch: bool,
force_delete: bool,
- branch_deleted: bool,
+ deletion_result: Option<Option<IntegrationReason>>,
+ target_branch: Option<&str>,
) -> String {
// Build the action description based on actual outcome
- let action = if no_delete_branch || !branch_deleted {
+ let action = if no_delete_branch || deletion_result.is_none() {
"Removed worktree"
} else {
"Removed worktree & branch"
};
// Show flag acknowledgment when applicable
- let flag_note = get_flag_note(no_delete_branch, force_delete, branch_deleted);
+ let flag_note = get_flag_note(
+ no_delete_branch,
+ force_delete,
+ deletion_result,
+ target_branch,
+ );
let branch_display = branch.or(Some(branch_name));
@@ -366,9 +415,9 @@ fn handle_branch_only_output(
let repo = worktrunk::git::Repository::current();
let result = delete_branch_if_safe(&repo, branch_name, "HEAD", force_delete);
- let deleted = handle_branch_deletion_result(result, branch_name)?;
+ let integration_reason = handle_branch_deletion_result(result, branch_name)?;
- if deleted {
+ if integration_reason.is_some() {
let flag_note = if force_delete {
" (--force-delete)"
} else {
@@ -433,32 +482,47 @@ fn handle_removed_worktree_output(
if background {
// Background mode: spawn detached process
- // Determine if we should delete the branch (check once upfront)
- let should_delete_branch = if no_delete_branch {
- false
+ // Determine if we should delete the branch and why (check once upfront)
+ let (should_delete_branch, integration_reason) = if no_delete_branch {
+ (false, None)
} else if force_delete {
// Force delete requested - always delete
- true
+ (true, None)
} else {
// Check if branch is integrated (ancestor or matching tree content)
let check_target = target_branch.unwrap_or("HEAD");
let deletion_repo = worktrunk::git::Repository::at(main_path);
- is_branch_integrated(&deletion_repo, branch_name, check_target)
+ let reason = get_integration_reason(&deletion_repo, branch_name, check_target);
+ (reason.is_some(), reason)
};
- // Show progress message based on what we'll do
+ // Build deletion_result in the format expected by get_flag_note
+ let deletion_result: Option<Option<IntegrationReason>> = if should_delete_branch {
+ if force_delete {
+ Some(None) // force-deleted
+ } else {
+ Some(integration_reason) // integrated
+ }
+ } else {
+ None // not deleted
+ };
+
+ let flag_note = get_flag_note(
+ no_delete_branch,
+ force_delete,
+ deletion_result,
+ target_branch,
+ );
+
+ // Reason in parentheses: user flags shown explicitly, integration reason for automatic cleanup
let action = if no_delete_branch {
cformat!(
- "<cyan>Removing <bold>{branch_name}</> worktree in background; retaining branch (--no-delete-branch)</>"
+ "<cyan>Removing <bold>{branch_name}</> worktree in background; retaining branch{flag_note}</>"
)
} else if should_delete_branch {
- if force_delete {
- cformat!(
- "<cyan>Removing <bold>{branch_name}</> worktree & branch in background (--force-delete)</>"
- )
- } else {
- cformat!("<cyan>Removing <bold>{branch_name}</> worktree & branch in background</>")
- }
+ cformat!(
+ "<cyan>Removing <bold>{branch_name}</> worktree & branch in background{flag_note}</>"
+ )
} else {
cformat!(
"<cyan>Removing <bold>{branch_name}</> worktree in background; retaining unmerged branch</>"
@@ -493,14 +557,14 @@ fn handle_removed_worktree_output(
}
// Delete the branch (unless --no-delete-branch was specified)
- let branch_deleted = if !no_delete_branch {
+ let integration_reason = if !no_delete_branch {
let deletion_repo = worktrunk::git::Repository::at(main_path);
let check_target = target_branch.unwrap_or("HEAD");
let result =
delete_branch_if_safe(&deletion_repo, branch_name, check_target, force_delete);
handle_branch_deletion_result(result, branch_name)?
} else {
- false
+ None
};
// Show success message (includes emoji and color)
@@ -511,7 +575,8 @@ fn handle_removed_worktree_output(
branch,
no_delete_branch,
force_delete,
- branch_deleted,
+ integration_reason,
+ target_branch,
))?;
super::flush()?;
Ok(())
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_bash.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_bash.snap
index f3f8565df..bba6bd184 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_bash.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_bash.snap
@@ -27,4 +27,4 @@ expression: output.normalized()
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_zsh.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_zsh.snap
index f3f8565df..bba6bd184 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_zsh.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_mixed_stdout_stderr_zsh.snap
@@ -27,4 +27,4 @@ expression: output.normalized()
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_bash.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_bash.snap
index 36f021307..50ca600b5 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_bash.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_bash.snap
@@ -16,4 +16,4 @@ expression: output.normalized()
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_zsh.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_zsh.snap
index 36f021307..50ca600b5 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_zsh.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__merge_with_pre_merge_success_zsh.snap
@@ -16,4 +16,4 @@ expression: output.normalized()
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_pre_merge.snap b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_pre_merge.snap
index abacf40c2..b8ba96e80 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_pre_merge.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_hooks_pre_merge.snap
@@ -32,4 +32,4 @@ All checks passed!
  tests/test_auth.py | 14 ++++++++++++++
  2 files changed, 45 insertions(+)
✅ Merged to main (1 commit, 2 files, +45)
-🔄 Removing feature-auth worktree & branch in background
+🔄 Removing feature-auth worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__directives__merge_internal_remove.snap b/tests/snapshots/integration__integration_tests__directives__merge_internal_remove.snap
index f7598b697..af54fb473 100644
--- a/tests/snapshots/integration__integration_tests__directives__merge_internal_remove.snap
+++ b/tests/snapshots/integration__integration_tests__directives__merge_internal_remove.snap
@@ -31,4 +31,4 @@ cd '[PATH]'
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_and_squash.snap b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_and_squash.snap
index f674cba89..03a3c942d 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_and_squash.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_and_squash.snap
@@ -35,4 +35,4 @@ exit_code: 0
  file2.txt | 1 +
  2 files changed, 2 insertions(+)
✅ Merged to main (1 commit, 2 files, +2)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap
index c4d5afb9a..d000c84e9 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_deterministic.snap
@@ -38,4 +38,4 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_llm.snap b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_llm.snap
index bd720607b..cb0e5c96f 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_llm.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_auto_commit_with_llm.snap
@@ -34,4 +34,4 @@ exit_code: 0
  auth.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_dirty_working_tree.snap b/tests/snapshots/integration__integration_tests__merge__merge_dirty_working_tree.snap
index 482d0eabe..11ceaa59e 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_dirty_working_tree.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_dirty_working_tree.snap
@@ -35,4 +35,4 @@ exit_code: 0
  dirty.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap b/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap
index 9816b7d9a..fdf6b1ab7 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_fast_forward.snap
@@ -29,4 +29,4 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_commits.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_commits.snap
index ecc96632b..27b9686a3 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_commits.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_commits.snap
@@ -25,4 +25,4 @@ exit_code: 0
----- stderr -----
⚪ Already up to date with main (no new commits, no rebase needed)
-🔄 Removing no-commits worktree & branch in background
+🔄 Removing no-commits worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_commits_with_changes.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_commits_with_changes.snap
index c33e83326..6fdb9765d 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_commits_with_changes.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_commits_with_changes.snap
@@ -35,4 +35,4 @@ exit_code: 0
  newfile.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing no-commits-dirty worktree & branch in background
+🔄 Removing no-commits-dirty worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_remote.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_remote.snap
index 05c0b01e8..10efbcf60 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_remote.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_remote.snap
@@ -28,4 +28,4 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_no_squash.snap b/tests/snapshots/integration__integration_tests__merge__merge_no_squash.snap
index bf90d5585..1b4255a82 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_no_squash.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_no_squash.snap
@@ -32,4 +32,4 @@ exit_code: 0
  file2.txt | 1 +
  2 files changed, 2 insertions(+)
✅ Merged to main (2 commits, 2 files, +2)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap b/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap
index cef1a7f25..a4cb7d716 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_not_fast_forward.snap
@@ -29,4 +29,4 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_failure.snap b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_failure.snap
index 95c731a84..22ddd76b6 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_failure.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_failure.snap
@@ -30,7 +30,7 @@ exit_code: 1
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
🔄 Running post-merge:
  exit 1
🟡 Command failed: exit status: 1
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_named.snap b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_named.snap
index 42378ea67..b576391c2 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_named.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_named.snap
@@ -30,7 +30,7 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
🔄 Running post-merge notify:
  echo 'Merge to main complete' > notify.txt
🔄 Running post-merge deploy:
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_no_verify.snap b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_no_verify.snap
index 09b8f326c..988600bb1 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_no_verify.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_no_verify.snap
@@ -31,4 +31,4 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_success.snap b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_success.snap
index 9cfe14b44..84a0e020d 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_success.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_command_success.snap
@@ -30,7 +30,7 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
🔄 Running post-merge:
  echo 'merged feature to main' > post-merge-ran.txt

diff --git a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_runs_with_nothing_to_merge.snap b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_runs_with_nothing_to_merge.snap
index 6ddebe421..60f7f2949 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_post_merge_runs_with_nothing_to_merge.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_post_merge_runs_with_nothing_to_merge.snap
@@ -26,7 +26,7 @@ exit_code: 0
----- stderr -----
⚪ Already up to date with main (no new commits, no rebase needed)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
🔄 Running post-merge:
  echo 'post-merge ran' > post-merge-ran.txt

diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_commit_command_success.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_commit_command_success.snap
index 77b59ca51..bbcf18cf9 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_commit_command_success.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_commit_command_success.snap
@@ -39,4 +39,4 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_named.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_named.snap
index 4a7fa59a5..419f61b92 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_named.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_named.snap
@@ -36,4 +36,4 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_success.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_success.snap
index 906d2937e..f7666ef86 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_success.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_command_success.snap
@@ -32,4 +32,4 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_squash_command_success.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_squash_command_success.snap
index 26f7d69aa..0b8d7dbfe 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_squash_command_success.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_squash_command_success.snap
@@ -33,4 +33,4 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_primary_on_different_branch.snap b/tests/snapshots/integration__integration_tests__merge__merge_primary_on_different_branch.snap
index f18224e43..0c19527fb 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_primary_on_different_branch.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_primary_on_different_branch.snap
@@ -29,4 +29,4 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature-from-develop worktree & branch in background
+🔄 Removing feature-from-develop worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_primary_on_different_branch_dirty.snap b/tests/snapshots/integration__integration_tests__merge__merge_primary_on_different_branch_dirty.snap
index 44b5936ee..919f46b32 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_primary_on_different_branch_dirty.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_primary_on_different_branch_dirty.snap
@@ -31,4 +31,4 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature-dirty-primary worktree & branch in background
+🔄 Removing feature-dirty-primary worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_rebase_fast_forward.snap b/tests/snapshots/integration__integration_tests__merge__merge_rebase_fast_forward.snap
index f1d2cb74a..5fb09acdb 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_rebase_fast_forward.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_rebase_fast_forward.snap
@@ -26,4 +26,4 @@ exit_code: 0
----- stderr -----
✅ Fast-forwarded to main
⚪ Already up to date with main (no new commits)
-🔄 Removing fast-forward-test worktree & branch in background
+🔄 Removing fast-forward-test worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_rebase_true_rebase.snap b/tests/snapshots/integration__integration_tests__merge__merge_rebase_true_rebase.snap
index 50af598fc..f3196bee4 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_rebase_true_rebase.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_rebase_true_rebase.snap
@@ -31,4 +31,4 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing true-rebase-test worktree & branch in background
+🔄 Removing true-rebase-test worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
index ab8aacdd5..aa59bd1fd 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_deterministic.snap
@@ -41,4 +41,4 @@ exit_code: 0
  file3.txt | 1 +
  3 files changed, 3 insertions(+)
✅ Merged to main (1 commit, 3 files, +3)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap
index bb181861a..b3843cc91 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_empty_changes.snap
@@ -35,4 +35,4 @@ exit_code: 0
  - Revert to initial
⚪ No changes after squashing 3 commits
⚪ Already up to date with main (no new commits, no rebase needed)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap
index 383a5e206..9bf5690b3 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_llm_fallback.snap
@@ -40,4 +40,4 @@ exit_code: 0
  file2.txt | 1 +
  2 files changed, 2 insertions(+)
✅ Merged to main (1 commit, 2 files, +2)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap
index c04fe02f7..2a598ee12 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_single_commit.snap
@@ -29,4 +29,4 @@ exit_code: 0
  file1.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap
index a91c41792..899d69eee 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_llm.snap
@@ -33,4 +33,4 @@ exit_code: 0
  auth.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_working_tree_creates_backup.snap b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_working_tree_creates_backup.snap
index 3dcb12c6b..aec367d16 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_squash_with_working_tree_creates_backup.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_squash_with_working_tree_creates_backup.snap
@@ -42,4 +42,4 @@ exit_code: 0
  file2.txt | 1 +
  2 files changed, 2 insertions(+)
✅ Merged to main (1 commit, 2 files, +2)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap b/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap
index 05c0b01e8..10efbcf60 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_to_default.snap
@@ -28,4 +28,4 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_to_non_default_target.snap b/tests/snapshots/integration__integration_tests__merge__merge_to_non_default_target.snap
index e5d13c094..3c71e6f1a 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_to_non_default_target.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_to_non_default_target.snap
@@ -31,4 +31,4 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to staging (1 commit, 1 file, +1)
-🔄 Removing feature-for-staging worktree & branch in background
+🔄 Removing feature-for-staging worktree & branch in background (ancestor of staging)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_when_primary_not_on_default_but_default_has_worktree.snap b/tests/snapshots/integration__integration_tests__merge__merge_when_primary_not_on_default_but_default_has_worktree.snap
index 9816b7d9a..fdf6b1ab7 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_when_primary_not_on_default_but_default_has_worktree.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_when_primary_not_on_default_but_default_has_worktree.snap
@@ -29,4 +29,4 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_caret.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_caret.snap
index fa8cd3c65..f58afb55e 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_with_caret.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_with_caret.snap
@@ -29,4 +29,4 @@ exit_code: 0
  feature.txt | 1 +
  1 file changed, 1 insertion(+)
✅ Merged to main (1 commit, 1 file, +1)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__merge_with_untracked_files.snap b/tests/snapshots/integration__integration_tests__merge__merge_with_untracked_files.snap
index 99709a0ab..c9f7db256 100644
--- a/tests/snapshots/integration__integration_tests__merge__merge_with_untracked_files.snap
+++ b/tests/snapshots/integration__integration_tests__merge__merge_with_untracked_files.snap
@@ -45,4 +45,4 @@ exit_code: 0
  untracked2.txt | 1 +
  3 files changed, 3 insertions(+)
✅ Merged to main (1 commit, 3 files, +3)
-🔄 Removing feature worktree & branch in background
+🔄 Removing feature worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap b/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap
index 0f188124e..307f20a91 100644
--- a/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap
+++ b/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap
@@ -61,7 +61,7 @@ test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; fin
  jwt.rs | 8 ++++++++
  3 files changed, 33 insertions(+)
✅ Merged to main (1 commit, 3 files, +33)
-🔄 Removing feature-auth worktree & branch in background
+🔄 Removing feature-auth worktree & branch in background (ancestor of main)
🔄 Running post-merge install:
  cargo install --path .
 Installing worktrunk v0.1.0
diff --git a/tests/snapshots/integration__integration_tests__merge__readme_example_hooks_pre_merge.snap b/tests/snapshots/integration__integration_tests__merge__readme_example_hooks_pre_merge.snap
index 85476e237..554ff63ad 100644
--- a/tests/snapshots/integration__integration_tests__merge__readme_example_hooks_pre_merge.snap
+++ b/tests/snapshots/integration__integration_tests__merge__readme_example_hooks_pre_merge.snap
@@ -56,4 +56,4 @@ All checks passed!
  tests/test_auth.py | 14 ++++++++++++++
  2 files changed, 45 insertions(+)
✅ Merged to main (1 commit, 2 files, +45)
-🔄 Removing feature-auth worktree & branch in background
+🔄 Removing feature-auth worktree & branch in background (ancestor of main)
diff --git a/tests/snapshots/integration__integration_tests__merge__readme_example_simple.snap b/tests/snapshots/integration__integration_tests__merge__readme_example_simple.snap
index 2e661a3db..803906331 100644
--- a/tests/snapshots/integration__integration_tests__merge__readme_example_simple.snap
+++ b/tests/snapshots/integration__integration_tests__merge__readme_example_simple.snap
@@ -29,4 +29,4 @@ exit_code: 0
  auth.rs | 13 +++++++++++++
  1 file changed, 13 insertions(+)
✅ Merged to main (1 commit, 1 file, +13)
-🔄 Removing fix-auth worktree & branch in background
+🔄 Removing fix-auth worktree & branch in background (ancestor of main)