Skip to content

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

feat: Add `--remotes` flag to `wt list` and update snapshots

Maximilian Roosade9edf47eb8
diff --git a/.claude-plugin/skills/worktrunk/reference/README.md b/.claude-plugin/skills/worktrunk/reference/README.md
index 4ec45aabf..28895d3e6 100644
--- a/.claude-plugin/skills/worktrunk/reference/README.md
+++ b/.claude-plugin/skills/worktrunk/reference/README.md
@@ -18,7 +18,8 @@ colliding; each agent gets a separate directory with a version of the code. But
creating worktrees, tracking paths & statuses, cleaning up, etc, is manual.
Worktrunk offers control, transparency & automation for this workflow.
-![Worktrunk Demo](scripts/wt-demo/out/wt-demo.gif)
+<!-- TODO: Add demo gif when available -->
+<!-- ![Worktrunk Demo](scripts/wt-demo/out/wt-demo.gif) -->
## Quick Start
diff --git a/README.md b/README.md
index 4ec45aabf..28895d3e6 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,8 @@ colliding; each agent gets a separate directory with a version of the code. But
creating worktrees, tracking paths & statuses, cleaning up, etc, is manual.
Worktrunk offers control, transparency & automation for this workflow.
-![Worktrunk Demo](scripts/wt-demo/out/wt-demo.gif)
+<!-- TODO: Add demo gif when available -->
+<!-- ![Worktrunk Demo](scripts/wt-demo/out/wt-demo.gif) -->
## Quick Start
diff --git a/src/cli.rs b/src/cli.rs
index 9d76779f2..e8cdb678d 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -463,6 +463,10 @@ Note: `locked` and `prunable` are top-level fields on worktree objects, not in s
#[arg(long)]
branches: bool,
+ /// Include remote branches from primary remote
+ #[arg(long)]
+ remotes: bool,
+
/// Show CI, conflicts, diffs
#[arg(long)]
full: bool,
diff --git a/src/commands/list/collect.rs b/src/commands/list/collect.rs
index e6dd32e3b..43d238e41 100644
--- a/src/commands/list/collect.rs
+++ b/src/commands/list/collect.rs
@@ -427,15 +427,58 @@ fn get_branches_without_worktrees(
Ok(branches_without_worktrees)
}
+/// Get remote branches from the primary remote that don't have local worktrees.
+///
+/// Returns (branch_name, commit_sha) pairs for remote branches.
+/// Filters out branches that already have worktrees (whether the worktree is on the
+/// local tracking branch or not).
+fn get_remote_branches(
+ repo: &Repository,
+ worktrees: &[Worktree],
+) -> anyhow::Result<Vec<(String, String)>> {
+ // Get all remote branches from primary remote
+ let all_remote_branches = repo.list_remote_branches()?;
+
+ // Get primary remote name for prefix stripping
+ let remote = repo.primary_remote()?;
+ let remote_prefix = format!("{}/", remote);
+
+ // Build a set of branch names that have worktrees
+ let worktree_branches: std::collections::HashSet<String> = worktrees
+ .iter()
+ .filter_map(|wt| wt.branch.clone())
+ .collect();
+
+ // Filter to remote branches whose local equivalent doesn't have a worktree
+ let remote_branches: Vec<_> = all_remote_branches
+ .into_iter()
+ .filter(|(remote_branch_name, _)| {
+ // Extract local branch name from "<remote>/feature" -> "feature"
+ // Only include branches that have the expected prefix format
+ if let Some(local_name) = remote_branch_name.strip_prefix(&remote_prefix) {
+ // Include remote branch if local branch doesn't have a worktree
+ !worktree_branches.contains(local_name)
+ } else {
+ // Skip branches that don't have the expected prefix (e.g., just "origin")
+ false
+ }
+ })
+ .collect();
+
+ Ok(remote_branches)
+}
+
/// Collect worktree data with optional progressive rendering.
///
/// When `show_progress` is true, renders a skeleton immediately and updates as data arrives.
/// When false, behavior depends on `render_table`:
/// - If `render_table` is true: renders final table (buffered mode)
/// - If `render_table` is false: returns data without rendering (JSON mode)
+#[allow(clippy::too_many_arguments)]
pub fn collect(
repo: &Repository,
show_branches: bool,
+ show_remotes: bool,
show_full: bool,
fetch_ci: bool,
check_merge_tree_conflicts: bool,
@@ -473,6 +516,13 @@ pub fn collect(
Vec::new()
};
+ // Get remote branches (when --remotes is used)
+ let remote_branches = if show_remotes {
+ get_remote_branches(repo, &worktrees.worktrees)?
+ } else {
+ Vec::new()
+ };
+
// Initialize worktree items with identity fields and None for computed fields
let mut all_items: Vec<super::model::ListItem> = sorted_worktrees
.iter()
@@ -513,7 +563,26 @@ pub fn collect(
});
}
- // Calculate layout from items (both worktrees and branches)
+ // Initialize remote branch items with identity fields and None for computed fields
+ let remote_start_idx = all_items.len();
+ for (branch_name, commit_sha) in &remote_branches {
+ all_items.push(super::model::ListItem {
+ // Common fields
+ head: commit_sha.clone(),
+ branch: Some(branch_name.clone()),
+ commit: None,
+ counts: None,
+ branch_diff: None,
+ upstream: None,
+ pr_status: None,
+ status_symbols: None,
+ display: super::model::DisplayFields::default(),
+ // Type-specific data
+ kind: super::model::ItemKind::Branch,
+ });
+ }
+
+ // Calculate layout from items (worktrees, local branches, and remote branches)
let layout = super::layout::calculate_layout_from_basics(&all_items, show_full, fetch_ci);
// Single-line invariant: use safe width to prevent line wrapping
@@ -525,16 +594,23 @@ pub fn collect(
.iter()
.filter(|item| item.worktree_data().is_some())
.count();
- let num_branches = all_items.len() - num_worktrees;
- let footer_base = if show_branches && num_branches > 0 {
- format!(
- "Showing {} worktrees, {} branches",
- num_worktrees, num_branches
- )
- } else {
- let plural = if num_worktrees == 1 { "" } else { "s" };
- format!("Showing {} worktree{}", num_worktrees, plural)
- };
+ let num_local_branches = branches_without_worktrees.len();
+ let num_remote_branches = remote_branches.len();
+
+ let footer_base =
+ if (show_branches && num_local_branches > 0) || (show_remotes && num_remote_branches > 0) {
+ let mut parts = vec![format!("{} worktrees", num_worktrees)];
+ if show_branches && num_local_branches > 0 {
+ parts.push(format!("{} branches", num_local_branches));
+ }
+ if show_remotes && num_remote_branches > 0 {
+ parts.push(format!("{} remote branches", num_remote_branches));
+ }
+ format!("Showing {}", parts.join(", "))
+ } else {
+ let plural = if num_worktrees == 1 { "" } else { "s" };
+ format!("Showing {} worktree{}", num_worktrees, plural)
+ };
// Create progressive table if showing progress
let mut progressive_table = if show_progress {
@@ -628,6 +704,30 @@ pub fn collect(
});
}
+ // Spawn remote branch collection in background thread (if requested)
+ if show_remotes {
+ let remote_branches_clone = remote_branches.clone();
+ let main_path = main_worktree.path.clone();
+ let tx_remote = tx.clone();
+ let default_branch_clone = default_branch.clone();
+ std::thread::spawn(move || {
+ remote_branches_clone.par_iter().enumerate().for_each(
+ |(idx, (branch_name, commit_sha))| {
+ let item_idx = remote_start_idx + idx;
+ super::collect_progressive_impl::collect_branch_progressive(
+ branch_name,
+ commit_sha,
+ &main_path,
+ item_idx,
+ &default_branch_clone,
+ &options,
+ tx_remote.clone(),
+ );
+ },
+ );
+ });
+ }
+
// Drop the original sender so drain_cell_updates knows when all spawned threads are done
drop(tx);
@@ -692,8 +792,11 @@ pub fn collect(
// Finalize progressive table or render buffered output
if let Some(mut table) = progressive_table {
// Build final summary string
- let final_msg =
- super::format_summary_message(&all_items, show_branches, layout.hidden_nonempty_count);
+ let final_msg = super::format_summary_message(
+ &all_items,
+ show_branches || show_remotes,
+ layout.hidden_nonempty_count,
+ );
if table.is_tty() {
// Interactive: do final render pass and update footer to summary
@@ -718,8 +821,11 @@ pub fn collect(
}
} else if render_table {
// Buffered mode: render final table
- let final_msg =
- super::format_summary_message(&all_items, show_branches, layout.hidden_nonempty_count);
+ let final_msg = super::format_summary_message(
+ &all_items,
+ show_branches || show_remotes,
+ layout.hidden_nonempty_count,
+ );
crate::output::raw_terminal(layout.format_header_line())?;
for item in &all_items {
diff --git a/src/commands/list/mod.rs b/src/commands/list/mod.rs
index 83914f0fe..0d3b9e1de 100644
--- a/src/commands/list/mod.rs
+++ b/src/commands/list/mod.rs
@@ -95,6 +95,7 @@ use worktrunk::git::Repository;
pub fn handle_list(
format: crate::OutputFormat,
show_branches: bool,
+ show_remotes: bool,
show_full: bool,
render_mode: RenderMode,
) -> anyhow::Result<()> {
@@ -115,6 +116,7 @@ pub fn handle_list(
let list_data = collect::collect(
&repo,
show_branches,
+ show_remotes,
show_full,
fetch_ci,
check_merge_tree_conflicts,
@@ -145,7 +147,8 @@ pub fn handle_list(
#[derive(Default)]
pub(super) struct SummaryMetrics {
worktrees: usize,
- branches: usize,
+ local_branches: usize,
+ remote_branches: usize,
dirty_worktrees: usize,
ahead_items: usize,
}
@@ -171,7 +174,18 @@ impl SummaryMetrics {
self.dirty_worktrees += 1;
}
} else {
- self.branches += 1;
+ // Distinguish local vs remote branches by presence of '/' in name
+ // Remote branches are like "origin/feature", local are like "feature"
+ if item
+ .branch
+ .as_ref()
+ .map(|b| b.contains('/'))
+ .unwrap_or(false)
+ {
+ self.remote_branches += 1;
+ } else {
+ self.local_branches += 1;
+ }
}
let counts = item.counts();
@@ -189,8 +203,11 @@ impl SummaryMetrics {
if include_branches {
parts.push(format!("{} worktrees", self.worktrees));
- if self.branches > 0 {
- parts.push(format!("{} branches", self.branches));
+ if self.local_branches > 0 {
+ parts.push(format!("{} branches", self.local_branches));
+ }
+ if self.remote_branches > 0 {
+ parts.push(format!("{} remote branches", self.remote_branches));
}
} else {
let plural = if self.worktrees == 1 { "" } else { "s" };
diff --git a/src/commands/select.rs b/src/commands/select.rs
index 7d9fc7b1d..6643e0d38 100644
--- a/src/commands/select.rs
+++ b/src/commands/select.rs
@@ -252,6 +252,7 @@ pub fn handle_select() -> anyhow::Result<()> {
// Gather list data using simplified collection (buffered mode)
let Some(list_data) = collect::collect(
&repo, false, // show_branches (select only shows worktrees, not branches)
+ false, // show_remotes (select only shows worktrees, not remote branches)
false, // show_full (no full layout needed)
false, // fetch_ci (no CI with select command)
false, // check_conflicts (no conflict checking with select command)
diff --git a/src/config/user.rs b/src/config/user.rs
index b7e8ba7fd..460b01c72 100644
--- a/src/config/user.rs
+++ b/src/config/user.rs
@@ -147,6 +147,10 @@ pub struct ListConfig {
/// Include branches without worktrees by default
#[serde(skip_serializing_if = "Option::is_none")]
pub branches: Option<bool>,
+
+ /// Include remote branches by default
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub remotes: Option<bool>,
}
impl Default for WorktrunkConfig {
diff --git a/src/git/repository/mod.rs b/src/git/repository/mod.rs
index 4b5c26c0d..31d91b1ca 100644
--- a/src/git/repository/mod.rs
+++ b/src/git/repository/mod.rs
@@ -601,6 +601,43 @@ impl Repository {
Ok(branches)
}
+ /// List remote branches from the primary remote, excluding HEAD.
+ ///
+ /// Returns (branch_name, commit_sha) pairs for remote branches.
+ /// Branch names are in the form "origin/feature", not "feature".
+ /// Uses the primary remote (typically "origin", but respects upstream configuration).
+ pub fn list_remote_branches(&self) -> anyhow::Result<Vec<(String, String)>> {
+ let remote = self.primary_remote()?;
+ let remote_ref_path = format!("refs/remotes/{}/", remote);
+
+ let output = self.run_command(&[
+ "for-each-ref",
+ "--format=%(refname:short) %(objectname)",
+ &remote_ref_path,
+ ])?;
+
+ let remote_head = format!("{}/HEAD", remote);
+ let branches: Vec<(String, String)> = output
+ .lines()
+ .filter_map(|line| {
+ let parts: Vec<&str> = line.split_whitespace().collect();
+ if parts.len() == 2 {
+ let branch_name = parts[0];
+ // Skip <remote>/HEAD (symref)
+ if branch_name != remote_head {
+ Some((branch_name.to_string(), parts[1].to_string()))
+ } else {
+ None
+ }
+ } else {
+ None
+ }
+ })
+ .collect();
+
+ Ok(branches)
+ }
+
/// Get line diff statistics for working tree changes (unstaged + staged).
pub fn working_tree_diff_stats(&self) -> anyhow::Result<LineDiff> {
// Limit concurrent diff operations to reduce mmap thrash on pack files
diff --git a/src/main.rs b/src/main.rs
index 5a6acfdaf..ffa3c5c8f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -275,6 +275,7 @@ fn main() {
Commands::List {
format,
branches,
+ remotes,
full,
progressive,
no_progressive,
@@ -286,14 +287,21 @@ fn main() {
.context("Failed to load config")
.and_then(|config| {
// Get config values from global list config
- let (show_branches_config, show_full_config) = config
+ let (show_branches_config, show_remotes_config, show_full_config) = config
.list
.as_ref()
- .map(|l| (l.branches.unwrap_or(false), l.full.unwrap_or(false)))
- .unwrap_or((false, false));
+ .map(|l| {
+ (
+ l.branches.unwrap_or(false),
+ l.remotes.unwrap_or(false),
+ l.full.unwrap_or(false),
+ )
+ })
+ .unwrap_or((false, false, false));
// CLI flags override config
let show_branches = branches || show_branches_config;
+ let show_remotes = remotes || show_remotes_config;
let show_full = full || show_full_config;
// Convert two bools to Option<bool>: Some(true), Some(false), or None
@@ -303,7 +311,7 @@ fn main() {
_ => None,
};
let render_mode = RenderMode::detect(progressive_opt, cli.internal);
- handle_list(format, show_branches, show_full, render_mode)
+ handle_list(format, show_branches, show_remotes, show_full, render_mode)
})
}
Commands::Switch {
diff --git a/tests/common/list_snapshots.rs b/tests/common/list_snapshots.rs
index 54ed56693..2cd84c463 100644
--- a/tests/common/list_snapshots.rs
+++ b/tests/common/list_snapshots.rs
@@ -86,6 +86,18 @@ pub fn command_progressive_json(repo: &TestRepo) -> Command {
cmd
}
+pub fn command_remotes(repo: &TestRepo) -> Command {
+ let mut cmd = command(repo, repo.root_path());
+ cmd.arg("--remotes");
+ cmd
+}
+
+pub fn command_branches_and_remotes(repo: &TestRepo) -> Command {
+ let mut cmd = command(repo, repo.root_path());
+ cmd.args(["--branches", "--remotes"]);
+ cmd
+}
+
pub fn command_no_progressive_json(repo: &TestRepo) -> Command {
let mut cmd = command(repo, repo.root_path());
cmd.args(["--no-progressive", "--format=json"]);
diff --git a/tests/integration_tests/list.rs b/tests/integration_tests/list.rs
index 98080a27e..7723067f2 100644
--- a/tests/integration_tests/list.rs
+++ b/tests/integration_tests/list.rs
@@ -36,6 +36,22 @@ fn snapshot_list_with_branches(test_name: &str, repo: &TestRepo) {
);
}
+fn snapshot_list_with_remotes(test_name: &str, repo: &TestRepo) {
+ run_snapshot(
+ list_snapshots::standard_settings(repo),
+ test_name,
+ list_snapshots::command_remotes(repo),
+ );
+}
+
+fn snapshot_list_with_branches_and_remotes(test_name: &str, repo: &TestRepo) {
+ run_snapshot(
+ list_snapshots::standard_settings(repo),
+ test_name,
+ list_snapshots::command_branches_and_remotes(repo),
+ );
+}
+
fn snapshot_list_progressive(test_name: &str, repo: &TestRepo) {
run_snapshot(
list_snapshots::standard_settings(repo),
@@ -92,6 +108,16 @@ fn create_branch(repo: &TestRepo, branch_name: &str) {
.expect("Failed to create branch");
}
+/// Helper to push a branch to origin (creating a remote branch)
+fn push_branch(repo: &TestRepo, branch_name: &str) {
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.args(["push", "origin", branch_name])
+ .current_dir(repo.root_path())
+ .output()
+ .expect("Failed to push branch to origin");
+}
+
#[test]
fn test_list_single_worktree() {
let repo = TestRepo::new();
@@ -250,6 +276,94 @@ fn test_list_with_branches_flag_only_branches() {
snapshot_list_with_branches("with_branches_flag_only_branches", &repo);
}
+#[test]
+fn test_list_with_remotes_flag() {
+ let mut repo = TestRepo::new();
+ repo.commit("Initial commit");
+ // Setup remote creates origin and pushes main to it
+ repo.setup_remote("main");
+
+ // Create feature branches in the main repo and push them
+ create_branch(&repo, "remote-feature-1");
+ create_branch(&repo, "remote-feature-2");
+ push_branch(&repo, "remote-feature-1");
+ push_branch(&repo, "remote-feature-2");
+
+ // Delete the local branches - now they only exist as origin/remote-feature-*
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.args(["branch", "-D", "remote-feature-1", "remote-feature-2"])
+ .current_dir(repo.root_path())
+ .output()
+ .expect("Failed to delete local branches");
+
+ // Should show:
+ // - main worktree (primary)
+ // - origin/remote-feature-1 (remote branch without local worktree)
+ // - origin/remote-feature-2 (remote branch without local worktree)
+ // Should NOT show origin/main (main has a worktree)
+ snapshot_list_with_remotes("with_remotes_flag", &repo);
+}
+
+#[test]
+fn test_list_with_remotes_and_branches() {
+ let mut repo = TestRepo::new();
+ repo.commit("Initial commit");
+ repo.setup_remote("main");
+
+ // Create local-only branches (not worktrees, not pushed)
+ create_branch(&repo, "local-only-1");
+ create_branch(&repo, "local-only-2");
+
+ // Create branches, push them, then delete locally to make them remote-only
+ create_branch(&repo, "remote-only-1");
+ create_branch(&repo, "remote-only-2");
+ push_branch(&repo, "remote-only-1");
+ push_branch(&repo, "remote-only-2");
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.args(["branch", "-D", "remote-only-1", "remote-only-2"])
+ .current_dir(repo.root_path())
+ .output()
+ .expect("Failed to delete branches");
+
+ // Should show:
+ // - main worktree
+ // - local-only-1 branch (local, no worktree)
+ // - local-only-2 branch (local, no worktree)
+ // - origin/remote-only-1 (remote, no local)
+ // - origin/remote-only-2 (remote, no local)
+ snapshot_list_with_branches_and_remotes("with_remotes_and_branches", &repo);
+}
+
+#[test]
+fn test_list_with_remotes_filters_existing_worktrees() {
+ let mut repo = TestRepo::new();
+ repo.commit("Initial commit");
+ repo.setup_remote("main");
+
+ // Create a worktree and push the branch
+ repo.add_worktree("feature-with-worktree", "feature-with-worktree");
+ push_branch(&repo, "feature-with-worktree");
+
+ // Create a branch, push it, delete it locally (remote-only)
+ create_branch(&repo, "remote-only");
+ push_branch(&repo, "remote-only");
+ let mut cmd = Command::new("git");
+ repo.configure_git_cmd(&mut cmd);
+ cmd.args(["branch", "-D", "remote-only"])
+ .current_dir(repo.root_path())
+ .output()
+ .expect("Failed to delete branch");
+
+ // Should show:
+ // - main worktree
+ // - feature-with-worktree worktree
+ // - origin/remote-only (remote branch without local worktree)
+ // Should NOT show origin/main or origin/feature-with-worktree (both have worktrees)
+ snapshot_list_with_remotes("with_remotes_filters_worktrees", &repo);
+}
+
#[test]
fn test_list_json_with_display_fields() {
let mut repo = TestRepo::new();
diff --git a/tests/snapshots/integration__integration_tests__help__help_list.snap b/tests/snapshots/integration__integration_tests__help__help_list.snap
index 45e0b8060..db6b5b3c1 100644
--- a/tests/snapshots/integration__integration_tests__help__help_list.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_list.snap
@@ -25,6 +25,9 @@ Options:
--branches
Include branches without worktrees
+ --remotes
+ Include remote branches from primary remote
+
--full
Show CI, conflicts, diffs
diff --git a/tests/snapshots/integration__integration_tests__init__init_bash.snap b/tests/snapshots/integration__integration_tests__init__init_bash.snap
index 671bda039..b321e2fc6 100644
--- a/tests/snapshots/integration__integration_tests__init__init_bash.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_bash.snap
@@ -21,7 +21,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp6Iwk46/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmptUKRf7/test-config.toml
---
success: true
exit_code: 0
@@ -633,7 +633,7 @@ _wt() {
return 0
;;
wt__list)
- opts="-C -v -h --format --branches --full --progressive --no-progressive --verbose --help"
+ opts="-C -v -h --format --branches --remotes --full --progressive --no-progressive --verbose --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
diff --git a/tests/snapshots/integration__integration_tests__init__init_fish.snap b/tests/snapshots/integration__integration_tests__init__init_fish.snap
index d0bf04066..f06160897 100644
--- a/tests/snapshots/integration__integration_tests__init__init_fish.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_fish.snap
@@ -21,7 +21,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmph2v1TR/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpAjef2E/test-config.toml
---
success: true
exit_code: 0
@@ -274,6 +274,7 @@ complete -c wt -n "__fish_wt_using_subcommand list" -l format -d 'Output format
json\t'JSON output'"
complete -c wt -n "__fish_wt_using_subcommand list" -s C -d 'Change working directory' -r -F
complete -c wt -n "__fish_wt_using_subcommand list" -l branches -d 'Include branches without worktrees'
+complete -c wt -n "__fish_wt_using_subcommand list" -l remotes -d 'Include remote branches from primary remote'
complete -c wt -n "__fish_wt_using_subcommand list" -l full -d 'Show CI, conflicts, diffs'
complete -c wt -n "__fish_wt_using_subcommand list" -l progressive -d 'Force progressive (or --no-progressive)'
complete -c wt -n "__fish_wt_using_subcommand list" -l no-progressive -d 'Force buffered rendering'
diff --git a/tests/snapshots/integration__integration_tests__init__init_zsh.snap b/tests/snapshots/integration__integration_tests__init__init_zsh.snap
index 3a65a7ee8..63f5600d1 100644
--- a/tests/snapshots/integration__integration_tests__init__init_zsh.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_zsh.snap
@@ -21,7 +21,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp0Vu0V6/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpKR9Xgz/test-config.toml
---
success: true
exit_code: 0
@@ -454,6 +454,7 @@ _arguments "${_arguments_options[@]}" : \
json\:"JSON output"))' \
'-C+[Change working directory]:path:_files' \
'--branches[Include branches without worktrees]' \
+'--remotes[Include remote branches from primary remote]' \
'--full[Show CI, conflicts, diffs]' \
'--progressive[Force progressive (or --no-progressive)]' \
'--no-progressive[Force buffered rendering]' \
diff --git a/tests/snapshots/integration__integration_tests__list__with_remotes_and_branches.snap b/tests/snapshots/integration__integration_tests__list__with_remotes_and_branches.snap
new file mode 100644
index 000000000..0752fba90
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__list__with_remotes_and_branches.snap
@@ -0,0 +1,37 @@
+---
+source: tests/integration_tests/list.rs
+info:
+ program: wt
+ args:
+ - list
+ - "--branches"
+ - "--remotes"
+ env:
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "150"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_COUNT: "1"
+ GIT_CONFIG_GLOBAL: /dev/null
+ GIT_CONFIG_KEY_0: advice.mergeConflict
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_CONFIG_VALUE_0: "false"
+ GIT_EDITOR: ""
+ LANG: C
+ LC_ALL: C
+ SOURCE_DATE_EPOCH: "1761609600"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+ Branch Status HEAD± main↕ Path Remote⇅ Commit Age Message
+@ main . ↑0 ↓0 b834638e 10 months ago Initial commit
+ local-only-1 ∅ ⎇ b834638e 10 months ago Initial commit
+ local-only-2 ∅ ⎇ b834638e 10 months ago Initial commit
+ origin/remote-only-1 ∅ ⎇ b834638e 10 months ago Initial commit
+ origin/remote-only-2 ∅ ⎇ b834638e 10 months ago Initial commit
+
+⚪ Showing 1 worktrees, 2 branches, 2 remote branches
diff --git a/tests/snapshots/integration__integration_tests__list__with_remotes_filters_worktrees.snap b/tests/snapshots/integration__integration_tests__list__with_remotes_filters_worktrees.snap
new file mode 100644
index 000000000..0ff8ded78
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__list__with_remotes_filters_worktrees.snap
@@ -0,0 +1,34 @@
+---
+source: tests/integration_tests/list.rs
+info:
+ program: wt
+ args:
+ - list
+ - "--remotes"
+ env:
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "150"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_COUNT: "1"
+ GIT_CONFIG_GLOBAL: /dev/null
+ GIT_CONFIG_KEY_0: advice.mergeConflict
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_CONFIG_VALUE_0: "false"
+ GIT_EDITOR: ""
+ LANG: C
+ LC_ALL: C
+ SOURCE_DATE_EPOCH: "1761609600"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+ Branch Status HEAD± main↕ Path Remote⇅ Commit Age Message
+@ main ./test-repo ↑0 ↓0 b834638e 10 months ago Initial commit
++ feature-with-worktree ≡ ./feature-with-worktree b834638e 10 months ago Initial commit
+ origin/remote-only ∅ ⎇ b834638e 10 months ago Initial commit
+
+⚪ Showing 2 worktrees, 1 remote branches
diff --git a/tests/snapshots/integration__integration_tests__list__with_remotes_flag.snap b/tests/snapshots/integration__integration_tests__list__with_remotes_flag.snap
new file mode 100644
index 000000000..112c2eb2c
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__list__with_remotes_flag.snap
@@ -0,0 +1,34 @@
+---
+source: tests/integration_tests/list.rs
+info:
+ program: wt
+ args:
+ - list
+ - "--remotes"
+ env:
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "150"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_CONFIG_COUNT: "1"
+ GIT_CONFIG_GLOBAL: /dev/null
+ GIT_CONFIG_KEY_0: advice.mergeConflict
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_CONFIG_VALUE_0: "false"
+ GIT_EDITOR: ""
+ LANG: C
+ LC_ALL: C
+ SOURCE_DATE_EPOCH: "1761609600"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+
+----- stderr -----
+ Branch Status HEAD± main↕ Path Remote⇅ Commit Age Message
+@ main . ↑0 ↓0 b834638e 10 months ago Initial commit
+ origin/remote-feature-1 ∅ ⎇ b834638e 10 months ago Initial commit
+ origin/remote-feature-2 ∅ ⎇ b834638e 10 months ago Initial commit
+
+⚪ Showing 1 worktrees, 2 remote branches