Skip to content

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

feat: Add hint for deleting unmerged branches

Maximilian Roos73012139945a
diff --git a/src/output/handlers.rs b/src/output/handlers.rs
index 47574d422..c503bf1af 100644
--- a/src/output/handlers.rs
+++ b/src/output/handlers.rs
@@ -9,7 +9,7 @@ use worktrunk::git::GitError;
use worktrunk::git::Repository;
use worktrunk::path::format_path_for_display;
use worktrunk::shell::Shell;
-use worktrunk::styling::format_with_gutter;
+use worktrunk::styling::{HINT_EMOJI, format_with_gutter};
/// Format a switch success message with a consistent location phrase
///
@@ -146,6 +146,9 @@ fn handle_branch_deletion_result(
super::info(cformat!(
"Branch <bold>{branch_name}</> retained; has unmerged changes"
))?;
+ super::print(cformat!(
+ "{HINT_EMOJI} <dim>Use </>wt remove -D<dim> to delete unmerged branches</>"
+ ))?;
Ok(None)
}
Err(e) => {
@@ -533,6 +536,13 @@ fn handle_removed_worktree_output(
};
super::progress(action)?;
+ // Show hint for unmerged branches (same as synchronous path)
+ if !no_delete_branch && !should_delete_branch {
+ super::print(cformat!(
+ "{HINT_EMOJI} <dim>Use </>wt remove -D<dim> to delete unmerged branches</>"
+ ))?;
+ }
+
// Build command with the decision we already made
let remove_command =
build_remove_command(worktree_path, should_delete_branch.then_some(branch_name));
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_branch_not_fully_merged.snap b/tests/snapshots/integration__integration_tests__remove__remove_branch_not_fully_merged.snap
index bf22460f9..d25d89ecf 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_branch_not_fully_merged.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_branch_not_fully_merged.snap
@@ -24,3 +24,4 @@ exit_code: 0
----- stderr -----
πŸ”„ Removing feature-unmerged worktree in background; retaining unmerged branch
+πŸ’‘ Use wt remove -D to delete unmerged branches
diff --git a/tests/snapshots/integration__integration_tests__remove__remove_branch_only_unmerged.snap b/tests/snapshots/integration__integration_tests__remove__remove_branch_only_unmerged.snap
index 76d1cd214..d1a71698f 100644
--- a/tests/snapshots/integration__integration_tests__remove__remove_branch_only_unmerged.snap
+++ b/tests/snapshots/integration__integration_tests__remove__remove_branch_only_unmerged.snap
@@ -25,3 +25,4 @@ exit_code: 0
----- stderr -----
🟑 No worktree found for branch feature-unmerged
βšͺ Branch feature-unmerged retained; has unmerged changes
+πŸ’‘ Use wt remove -D to delete unmerged branches