Skip to content

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

Separate default_branch and target for branch status (#231)

Maximilian Roos5dc2a673b48e
diff --git a/docs/content/list.md b/docs/content/list.md
index dff617d0a..cb33505b0 100644
--- a/docs/content/list.md
+++ b/docs/content/list.md
@@ -117,11 +117,11 @@ The Status column has multiple subcolumns. Within each, only the first matching
| | `⚑` | Path doesn't match template |
| | `⊟` | Prunable (directory missing) |
| | `⊞` | Locked worktree |
-| Main | `^` | Is the main branch |
+| Main | `^` | Is the default branch |
| | `✗` | Would conflict if merged to main |
| | `_` | Same commit as main, clean |
| | `–` | Same commit as main, uncommitted changes |
-| | `⊂` | [Content integrated](@/remove.md#branch-cleanup) |
+| | `⊂` | Content [integrated](@/remove.md#branch-cleanup) into main or target |
| | `↕` | Diverged from main |
| | `↑` | Ahead of main |
| | `↓` | Behind main |
diff --git a/docs/content/remove.md b/docs/content/remove.md
index 48e2c6ad0..2516284f6 100644
--- a/docs/content/remove.md
+++ b/docs/content/remove.md
@@ -39,16 +39,19 @@ wt remove -D experimental
## Branch cleanup
-Branches delete automatically when their content is already in the target branch (typically main). This works with squash-merge and rebase workflows where commit history differs but file changes match.
+Branches delete automatically when merging them would add nothing. This works with squash-merge and rebase workflows where commit history differs but file changes match.
-A branch is safe to delete when its content is already reflected in the target. Worktrunk checks four conditions (in order of cost):
+Worktrunk checks five conditions (in order of cost):
-1. **Same commit** — Branch HEAD is literally the same commit as target.
-2. **No added changes** — Three-dot diff (`main...branch`) shows no files. The branch has no file changes beyond the merge-base (includes "branch is ancestor" case).
-3. **Tree contents match** — Branch tree SHA equals main tree SHA. Commit history differs but file contents are identical (e.g., after a revert or merge commit pulling in main).
-4. **Merge adds nothing** — Simulated merge (`git merge-tree`) produces the same tree as main. Handles squash-merged branches where main has since advanced.
+1. **Same commit** — Branch HEAD equals main. Shows `_` in `wt list`.
+2. **Ancestor** — Branch is in target's history (fast-forward or rebase case). Shows `⊂`.
+3. **No added changes** — Three-dot diff (`target...branch`) is empty. Shows `⊂`.
+4. **Trees match** — Branch tree SHA equals target tree SHA. Shows `⊂`.
+5. **Merge adds nothing** — Simulated merge produces the same tree as target. Handles squash-merged branches where target has advanced. Shows `⊂`.
-In `wt list`, `_` indicates same commit, and `⊂` indicates content is integrated. Branches showing either are dimmed as safe to delete.
+Check 1 compares against main. Checks 2-5 compare against **target** — main, or origin/main when it's strictly ahead (catching branches merged remotely before pulling).
+
+Branches showing `_` or `⊂` are dimmed as safe to delete.
Use `-D` to force-delete branches with unmerged changes. Use `--no-delete-branch` to keep the branch regardless of status.
diff --git a/src/cli.rs b/src/cli.rs
index 710ba1d3d..72de6bfab 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -1908,11 +1908,11 @@ The Status column has multiple subcolumns. Within each, only the first matching
| | `⚑` | Path doesn't match template |
| | `⊟` | Prunable (directory missing) |
| | `⊞` | Locked worktree |
-| Main | `^` | Is the main branch |
+| Main | `^` | Is the default branch |
| | `✗` | Would conflict if merged to main |
| | `_` | Same commit as main, clean |
| | `–` | Same commit as main, uncommitted changes |
-| | `⊂` | [Content integrated](@/remove.md#branch-cleanup) |
+| | `⊂` | Content [integrated](@/remove.md#branch-cleanup) into main or target |
| | `↕` | Diverged from main |
| | `↑` | Ahead of main |
| | `↓` | Behind main |
@@ -2145,16 +2145,19 @@ wt remove -D experimental
## Branch cleanup
-Branches delete automatically when their content is already in the target branch (typically main). This works with squash-merge and rebase workflows where commit history differs but file changes match.
+Branches delete automatically when merging them would add nothing. This works with squash-merge and rebase workflows where commit history differs but file changes match.
-A branch is safe to delete when its content is already reflected in the target. Worktrunk checks four conditions (in order of cost):
+Worktrunk checks five conditions (in order of cost):
-1. **Same commit** — Branch HEAD is literally the same commit as target.
-2. **No added changes** — Three-dot diff (`main...branch`) shows no files. The branch has no file changes beyond the merge-base (includes "branch is ancestor" case).
-3. **Tree contents match** — Branch tree SHA equals main tree SHA. Commit history differs but file contents are identical (e.g., after a revert or merge commit pulling in main).
-4. **Merge adds nothing** — Simulated merge (`git merge-tree`) produces the same tree as main. Handles squash-merged branches where main has since advanced.
+1. **Same commit** — Branch HEAD equals main. Shows `_` in `wt list`.
+2. **Ancestor** — Branch is in target's history (fast-forward or rebase case). Shows `⊂`.
+3. **No added changes** — Three-dot diff (`target...branch`) is empty. Shows `⊂`.
+4. **Trees match** — Branch tree SHA equals target tree SHA. Shows `⊂`.
+5. **Merge adds nothing** — Simulated merge produces the same tree as target. Handles squash-merged branches where target has advanced. Shows `⊂`.
-In `wt list`, `_` indicates same commit, and `⊂` indicates content is integrated. Branches showing either are dimmed as safe to delete.
+Check 1 compares against main. Checks 2-5 compare against **target** — main, or origin/main when it's strictly ahead (catching branches merged remotely before pulling).
+
+Branches showing `_` or `⊂` are dimmed as safe to delete.
Use `-D` to force-delete branches with unmerged changes. Use `--no-delete-branch` to keep the branch regardless of status.
diff --git a/src/commands/list/collect.rs b/src/commands/list/collect.rs
index 8792868e4..29977ba6b 100644
--- a/src/commands/list/collect.rs
+++ b/src/commands/list/collect.rs
@@ -701,7 +701,8 @@ pub fn collect(
// Spawn worktree collection in background thread
let sorted_worktrees_clone = sorted_worktrees.clone();
let tx_worktrees = tx.clone();
- let integration_target_clone = integration_target.clone();
+ let default_branch_clone = default_branch.clone();
+ let target_clone = integration_target.clone();
let expected_results_wt = expected_results.clone();
let options_wt = options.clone();
std::thread::spawn(move || {
@@ -709,12 +710,13 @@ pub fn collect(
.par_iter()
.enumerate()
.for_each(|(idx, wt)| {
- // Pass integration_target for ahead/behind/diff/integration checks.
- // May be upstream (origin/main) if it's ahead of local main.
+ // Pass default_branch (local default) for stable informational stats,
+ // and target (effective target) for integration checks.
super::collect_progressive_impl::collect_worktree_progressive(
wt,
idx,
- &integration_target_clone,
+ &default_branch_clone,
+ &target_clone,
&options_wt,
tx_worktrees.clone(),
&expected_results_wt,
@@ -745,7 +747,8 @@ pub fn collect(
let main_path = main_worktree.path.clone();
let tx_branches = tx.clone();
- let integration_target_clone = integration_target.clone();
+ let default_branch_clone = default_branch.clone();
+ let target_clone = integration_target.clone();
let expected_results_br = expected_results.clone();
let options_br = options.clone();
std::thread::spawn(move || {
@@ -757,7 +760,8 @@ pub fn collect(
commit_sha,
&main_path,
*item_idx,
- &integration_target_clone,
+ &default_branch_clone,
+ &target_clone,
&options_br,
tx_branches.clone(),
&expected_results_br,
@@ -999,14 +1003,16 @@ pub fn build_worktree_item(
/// Spawns parallel git operations and collects results. Modifies items in place
/// with: commit details, ahead/behind, diffs, upstream, CI, etc.
///
-/// The `integration_target` parameter is the effective target for integration checks
-/// (may be upstream like `origin/main` if it's ahead of local `main`).
+/// # Parameters
+/// - `default_branch`: Local default branch for informational stats (ahead/behind, branch diff)
+/// - `target`: Effective target for integration checks (may be upstream if ahead)
///
/// This is the blocking version used by statusline. For progressive rendering
/// with callbacks, see the `collect()` function.
pub fn populate_items(
items: &mut [ListItem],
- integration_target: &str,
+ default_branch: &str,
+ target: &str,
options: CollectOptions,
) -> anyhow::Result<()> {
use std::sync::Arc;
@@ -1038,7 +1044,8 @@ pub fn populate_items(
.collect();
// Spawn collection in background thread
- let integration_target_clone = integration_target.to_string();
+ let default_branch_clone = default_branch.to_string();
+ let target_clone = target.to_string();
let expected_results_clone = expected_results.clone();
std::thread::spawn(move || {
for (idx, path, head, branch) in worktree_info {
@@ -1055,7 +1062,8 @@ pub fn populate_items(
super::collect_progressive_impl::collect_worktree_progressive(
&wt,
idx,
- &integration_target_clone,
+ &default_branch_clone,
+ &target_clone,
&options,
tx.clone(),
&expected_results_clone,
@@ -1069,7 +1077,7 @@ pub fn populate_items(
let drain_outcome = drain_results(rx, items, &expected_results, |_item_idx, item, ctx| {
// Main worktree case is handled inside check_integration_state()
item.compute_status_symbols(
- Some(integration_target),
+ Some(target),
ctx.has_merge_tree_conflicts,
ctx.user_marker.clone(),
ctx.working_tree_status,
diff --git a/src/commands/list/collect_progressive_impl.rs b/src/commands/list/collect_progressive_impl.rs
index ebb68d182..e1e498df4 100644
--- a/src/commands/list/collect_progressive_impl.rs
+++ b/src/commands/list/collect_progressive_impl.rs
@@ -60,7 +60,12 @@ pub struct TaskContext {
pub repo_path: PathBuf,
pub commit_sha: String,
pub branch: Option<String>,
+ /// Local default branch for informational stats (ahead/behind, branch diff).
+ /// Always the local ref (e.g., "main"), providing stable comparisons.
pub default_branch: Option<String>,
+ /// Effective target for integration checks (status symbols, safe deletion).
+ /// May be upstream (e.g., "origin/main") if it's ahead of local, catching remotely-merged branches.
+ pub target: Option<String>,
pub item_idx: usize,
pub verbose_errors: bool,
}
@@ -158,13 +163,14 @@ impl Task for CommitDetailsTask {
}
}
-/// Task 2: Ahead/behind counts vs default branch
+/// Task 2: Ahead/behind counts vs local default branch (informational stats)
pub struct AheadBehindTask;
impl Task for AheadBehindTask {
const KIND: TaskKind = TaskKind::AheadBehind;
fn compute(ctx: TaskContext) -> TaskResult {
+ // Use default_branch (local default branch) for stable informational display
let (ahead, behind) = if let Some(base) = ctx.default_branch.as_deref() {
let repo = Repository::at(&ctx.repo_path);
match repo.ahead_behind(base, &ctx.commit_sha) {
@@ -190,14 +196,17 @@ impl Task for AheadBehindTask {
}
}
-/// Task 3: Tree identity check (does the item's commit tree match default branch's tree?)
+/// Task 3: Tree identity check (does the item's commit tree match integration target's tree?)
+///
+/// Uses target for integration detection (squash merge, rebase).
pub struct CommittedTreesMatchTask;
impl Task for CommittedTreesMatchTask {
const KIND: TaskKind = TaskKind::CommittedTreesMatch;
fn compute(ctx: TaskContext) -> TaskResult {
- let committed_trees_match = if let Some(base) = ctx.default_branch.as_deref() {
+ // Use target for integration detection
+ let committed_trees_match = if let Some(base) = ctx.target.as_deref() {
let repo = Repository::at(&ctx.repo_path);
// Use ctx.commit_sha (the item's commit) instead of HEAD,
// since for branches without worktrees, HEAD is the main worktree's HEAD
@@ -215,20 +224,23 @@ impl Task for CommittedTreesMatchTask {
/// Task 3b: File changes check (does branch have file changes beyond merge-base?)
///
-/// Uses three-dot diff (`main...branch`) to detect if the branch has any file
-/// changes relative to the merge-base with main. Returns false when the diff
-/// is empty, indicating the branch content is already integrated into main.
+/// Uses three-dot diff (`target...branch`) to detect if the branch has any file
+/// changes relative to the merge-base with target. Returns false when the diff
+/// is empty, indicating the branch content is already integrated.
///
/// This catches branches where commits exist (ahead > 0) but those commits
/// don't add any file changes - e.g., squash-merged branches, merge commits
/// that pulled in main, or commits whose changes were reverted.
+///
+/// Uses target for integration detection.
pub struct HasFileChangesTask;
impl Task for HasFileChangesTask {
const KIND: TaskKind = TaskKind::HasFileChanges;
fn compute(ctx: TaskContext) -> TaskResult {
- let has_file_changes = if let Some(base) = ctx.default_branch.as_deref() {
+ // Use target for integration detection
+ let has_file_changes = if let Some(base) = ctx.target.as_deref() {
let repo = Repository::at(&ctx.repo_path);
if let Some(branch) = ctx.branch.as_deref() {
// Check if three-dot diff is empty
@@ -238,7 +250,7 @@ impl Task for HasFileChangesTask {
true
}
} else {
- // No default branch - assume has changes
+ // No integration base - assume has changes
true
};
@@ -251,30 +263,33 @@ impl Task for HasFileChangesTask {
/// Task 3b: Merge simulation
///
-/// Checks if merging the branch into main would add any changes by simulating
+/// Checks if merging the branch into target would add any changes by simulating
/// the merge with `git merge-tree --write-tree`. Returns false when the merge
-/// result equals main's tree, indicating the branch is already integrated.
+/// result equals target's tree, indicating the branch is already integrated.
///
-/// This catches branches where main has advanced past the squash-merge point -
-/// the three-dot diff might show changes, but those changes are already in main
+/// This catches branches where target has advanced past the squash-merge point -
+/// the three-dot diff might show changes, but those changes are already in target
/// via the squash merge.
+///
+/// Uses target for integration detection.
pub struct WouldMergeAddTask;
impl Task for WouldMergeAddTask {
const KIND: TaskKind = TaskKind::WouldMergeAdd;
fn compute(ctx: TaskContext) -> TaskResult {
- let would_merge_add = if let Some(base) = ctx.default_branch.as_deref() {
+ // Use target for integration detection
+ let would_merge_add = if let Some(base) = ctx.target.as_deref() {
let repo = Repository::at(&ctx.repo_path);
if let Some(branch) = ctx.branch.as_deref() {
- // Simulate merging branch into main
+ // Simulate merging branch into target
repo.would_merge_add_to_target(branch, base).unwrap_or(true)
} else {
// No branch name (detached HEAD) - assume would add changes
true
}
} else {
- // No default branch - assume would add changes
+ // No integration base - assume would add changes
true
};
@@ -285,23 +300,27 @@ impl Task for WouldMergeAddTask {
}
}
-/// Task 3c: Ancestor check (is branch HEAD an ancestor of main?)
+/// Task 3c: Ancestor check (is branch HEAD an ancestor of integration target?)
+///
+/// Checks if branch is an ancestor of target - runs `git merge-base --is-ancestor`.
+/// Returns true when the branch HEAD is in target's history (merged via fast-forward
+/// or rebase).
///
-/// This is the cheapest integration check - just runs `git merge-base --is-ancestor`.
-/// Returns true when the branch HEAD is the same commit as main, or is an ancestor
-/// of main (already merged via fast-forward or rebase).
+/// Uses target (target) for the Ancestor integration reason in `⊂`.
+/// The `_` symbol uses ahead/behind counts (vs default_branch) instead.
pub struct IsAncestorTask;
impl Task for IsAncestorTask {
const KIND: TaskKind = TaskKind::IsAncestor;
fn compute(ctx: TaskContext) -> TaskResult {
- let is_ancestor = if let Some(base) = ctx.default_branch.as_deref() {
+ // Use target (target) for Ancestor integration reason
+ let is_ancestor = if let Some(base) = ctx.target.as_deref() {
let repo = Repository::at(&ctx.repo_path);
- // Check if branch HEAD is ancestor of main (or same commit)
+ // Check if branch HEAD is ancestor of target (or same commit)
repo.is_ancestor(&ctx.commit_sha, base).unwrap_or(false)
} else {
- // No default branch - assume not ancestor
+ // No integration base - assume not ancestor
false
};
@@ -312,13 +331,14 @@ impl Task for IsAncestorTask {
}
}
-/// Task 4: Branch diff stats vs default branch
+/// Task 4: Branch diff stats vs local default branch (informational stats)
pub struct BranchDiffTask;
impl Task for BranchDiffTask {
const KIND: TaskKind = TaskKind::BranchDiff;
fn compute(ctx: TaskContext) -> TaskResult {
+ // Use default_branch (local default branch) for stable informational display
let diff = if let Some(base) = ctx.default_branch.as_deref() {
let repo = Repository::at(&ctx.repo_path);
match repo.branch_diff_stats(base, &ctx.commit_sha) {
@@ -375,6 +395,7 @@ impl Task for WorkingTreeDiffTask {
LineDiff::default()
};
+ // Use default_branch (local default branch) for informational display
let working_tree_diff_with_main = repo
.working_tree_diff_with_base(ctx.default_branch.as_deref(), is_dirty)
.ok()
@@ -390,13 +411,17 @@ impl Task for WorkingTreeDiffTask {
}
}
-/// Task 6: Potential merge conflicts check (merge-tree vs default branch)
+/// Task 6: Potential merge conflicts check (merge-tree vs local main)
+///
+/// Uses default_branch (local main) for consistency with other Main subcolumn symbols.
+/// Shows whether merging to your local main would conflict.
pub struct MergeTreeConflictsTask;
impl Task for MergeTreeConflictsTask {
const KIND: TaskKind = TaskKind::MergeTreeConflicts;
fn compute(ctx: TaskContext) -> TaskResult {
+ // Use default_branch (local main) - consistent with other Main subcolumn symbols
let has_merge_tree_conflicts = if let Some(base) = ctx.default_branch.as_deref() {
let repo = Repository::at(&ctx.repo_path);
repo.has_merge_conflicts(base, &ctx.commit_sha)
@@ -534,10 +559,15 @@ impl Task for CiStatusTask {
///
/// Spawns parallel git operations (up to 10). Each task sends a TaskResult when it
/// completes, enabling progressive UI updates. Tasks in `options.skip_tasks` are not spawned.
+///
+/// # Parameters
+/// - `default_branch`: Local default branch for informational stats (ahead/behind, branch diff)
+/// - `target`: Effective target for integration checks (may be upstream if ahead)
pub fn collect_worktree_progressive(
wt: &Worktree,
item_idx: usize,
default_branch: &str,
+ target: &str,
options: &CollectOptions,
tx: Sender<TaskResult>,
expected_results: &Arc<ExpectedResults>,
@@ -549,6 +579,7 @@ pub fn collect_worktree_progressive(
commit_sha: wt.head.clone(),
branch: wt.branch.clone(),
default_branch: Some(default_branch.to_string()),
+ target: Some(target.to_string()),
item_idx,
verbose_errors: true, // Worktrees show verbose errors
};
@@ -588,6 +619,10 @@ pub fn collect_worktree_progressive(
///
/// Spawns parallel git operations (up to 7, similar to worktrees but without working
/// tree operations). Tasks in `options.skip_tasks` are not spawned.
+///
+/// # Parameters
+/// - `default_branch`: Local default branch for informational stats (ahead/behind, branch diff)
+/// - `target`: Effective target for integration checks (may be upstream if ahead)
#[allow(clippy::too_many_arguments)]
pub fn collect_branch_progressive(
branch_name: &str,
@@ -595,6 +630,7 @@ pub fn collect_branch_progressive(
repo_path: &std::path::Path,
item_idx: usize,
default_branch: &str,
+ target: &str,
options: &CollectOptions,
tx: Sender<TaskResult>,
expected_results: &Arc<ExpectedResults>,
@@ -606,6 +642,7 @@ pub fn collect_branch_progressive(
commit_sha: commit_sha.to_string(),
branch: Some(branch_name.to_string()),
default_branch: Some(default_branch.to_string()),
+ target: Some(target.to_string()),
item_idx,
verbose_errors: false, // Branches don't show verbose errors
};
diff --git a/src/commands/list/model.rs b/src/commands/list/model.rs
index b10b3b9c4..f02fcc421 100644
--- a/src/commands/list/model.rs
+++ b/src/commands/list/model.rs
@@ -509,12 +509,13 @@ impl ListItem {
// Separately detect SameCommit: same commit as main but with uncommitted work
// This is NOT an integration state (has work that would be lost on delete)
+ // Use ahead==0 && behind==0 (vs stats_base/main) to detect same commit
let has_tracked_changes = data
.working_tree_diff
.as_ref()
.is_some_and(|d| !d.is_empty());
- let is_same_commit_dirty = self.is_ancestor == Some(true)
- && self.counts.as_ref().is_some_and(|c| c.behind == 0)
+ let is_same_commit_dirty = counts.ahead == 0
+ && counts.behind == 0
&& (has_tracked_changes || has_untracked);
// Compute main state: combines is_main, would_conflict, integration, and divergence
@@ -596,9 +597,12 @@ impl ListItem {
return None;
}
- // Compute is_same_commit from is_ancestor and behind count
- let is_same_commit =
- self.is_ancestor == Some(true) && self.counts.as_ref().is_some_and(|c| c.behind == 0);
+ // Compute is_same_commit from ahead/behind counts (vs stats_base/main)
+ // This detects "same commit as main" for the _ symbol
+ let is_same_commit = self
+ .counts
+ .as_ref()
+ .is_some_and(|c| c.ahead == 0 && c.behind == 0);
// Use the shared integration check (same logic as wt remove)
let mut provider = PrecomputedIntegration {
diff --git a/src/commands/statusline.rs b/src/commands/statusline.rs
index db501b72a..3c535c3b8 100644
--- a/src/commands/statusline.rs
+++ b/src/commands/statusline.rs
@@ -245,7 +245,14 @@ fn get_git_status(repo: &Repository, cwd: &Path) -> Result<Option<String>> {
// Populate computed fields (parallel git operations) and format status_line
// Compute everything (same as --full) for complete status symbols
- list::populate_items(&mut items, &integration_target, CollectOptions::default())?;
+ // Pass default_branch for stable informational stats,
+ // and integration_target for integration status checks.
+ list::populate_items(
+ &mut items,
+ &default_branch,
+ &integration_target,
+ CollectOptions::default(),
+ )?;
// Return the pre-formatted statusline
if let Some(ref statusline) = items[0].display.statusline {
diff --git a/tests/snapshots/integration__integration_tests__help__help_list_long.snap b/tests/snapshots/integration__integration_tests__help__help_list_long.snap
index 06a22a072..e16fc8817 100644
--- a/tests/snapshots/integration__integration_tests__help__help_list_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_list_long.snap
@@ -131,11 +131,11 @@ The Status column has multiple subcolumns. Within each, only the first matching
⚑ Path doesn't match template
⊟ Prunable (directory missing)
⊞ Locked worktree
- Main ^ Is the main branch
+ Main ^ Is the default branch
✗ Would conflict if merged to main
_ Same commit as main, clean
– Same commit as main, uncommitted changes
- ⊂ Content integrated
+ ⊂ Content integrated into main or target
↕ Diverged from main
↑ Ahead of main
↓ Behind main
diff --git a/tests/snapshots/integration__integration_tests__help__help_remove_long.snap b/tests/snapshots/integration__integration_tests__help__help_remove_long.snap
index ec05ffacc..b382a427b 100644
--- a/tests/snapshots/integration__integration_tests__help__help_remove_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_remove_long.snap
@@ -77,20 +77,21 @@ Force-delete an unmerged branch:
Branch cleanup
-Branches delete automatically when their content is already in the target branch (typically main). This works with squash-merge and rebase workflows
-where commit history differs but file changes match.
+Branches delete automatically when merging them would add nothing. This works with squash-merge and rebase workflows where commit history differs but
+file changes match.
-A branch is safe to delete when its content is already reflected in the target. Worktrunk checks four conditions (in order of cost):
+Worktrunk checks five conditions (in order of cost):
-1. Same commit — Branch HEAD is literally the same commit as target.
-2. No added changes — Three-dot diff (main...branch) shows no files. The branch has no file changes beyond the merge-base (includes "branch is
-ancestor" case).
-3. Tree contents match — Branch tree SHA equals main tree SHA. Commit history differs but file contents are identical (e.g., after a revert or
-merge commit pulling in main).
-4. Merge adds nothing — Simulated merge (git merge-tree) produces the same tree as main. Handles squash-merged branches where main has since
-advanced.
+1. Same commit — Branch HEAD equals main. Shows _ in wt list.
+2. Ancestor — Branch is in target's history (fast-forward or rebase case). Shows ⊂.
+3. No added changes — Three-dot diff (target...branch) is empty. Shows ⊂.
+4. Trees match — Branch tree SHA equals target tree SHA. Shows ⊂.
+5. Merge adds nothing — Simulated merge produces the same tree as target. Handles squash-merged branches where target has advanced. Shows ⊂.
-In wt list, _ indicates same commit, and ⊂ indicates content is integrated. Branches showing either are dimmed as safe to delete.
+Check 1 compares against main. Checks 2-5 compare against target — main, or origin/main when it's strictly ahead (catching branches merged
+remotely before pulling).
+
+Branches showing _ or ⊂ are dimmed as safe to delete.
Use -D to force-delete branches with unmerged changes. Use --no-delete-branch to keep the branch regardless of status.