Add list ignore support for worktree paths and branch names
Adds [list].ignore config. These are glob patterns that hide worktrees and branches from wt list output. Motivation is when using tools like Cursor, which generate worktrees for each agent running in parallel, wt list becomes cluttered with these temporary worktrees and un-usable.
[list]
ignore = ["tmp-*", "*/scratch/*"]
Per-project overrides work via the [projects."..."] table (inherits through OverridableConfig).
Each pattern is matched two ways:
- As a path glob against the worktree's canonical filesystem path (e.g. /scratch/ matches worktrees inside a scratch/ directory)
- As a string match against the branch name (e.g. tmp-* matches any branch starting with tmp-)
A worktree or branch is hidden if either matches. Filtering applies uniformly to worktrees, local branches (--branches), and remote branches (--remotes).
wt list --ignored bypasses all ignore filtering and shows everything.
When items are filtered, the summary line includes the count: Showing 3 worktrees, 1 ignored.
Changes
- ignore: Option<Vec
> field on ListConfig - --ignored CLI flag on wt list
- Filtering in collect() after worktree/branch collection, before sorting — matches worktrees by path and branch name, local/remote branches by name
- SummaryMetrics.ignored count shown in the summary line when > 0
- glob crate added as a dependency
- 6 integration tests: single glob, array globs, --ignored flag, parent path matching, branch name matching, --branches filtering
I think I get the motivation, and I've had a similar experience at times
but I worry this might not quite pull its weight...
hardly my style to suggest multiple checkouts, but one approach is to give cursor another base checkout
OTOH I can't think of an easy way to do this without the feature. and we could make the downside less confusing with "X hidden" in the footer
I think I get the motivation, and I've had a similar experience at times
but I worry this might not quite pull its weight...
hardly my style to suggest multiple checkouts, but one approach is to give cursor another base checkout
OTOH I can't think of an easy way to do this without the feature. and we could make the downside less confusing with "X hidden" in the footer
In the Cursor case, if you use the "Use multiple agents" feature when implementing something, it automatically spins up worktrees for you in ~/.cursor/worktrees, its not something another base checkout helps with unfortunately
Re: X hidden, i did add that to the summary message- not sure if this is what you meant but it says ○ Showing 1 worktree, 4 ignored, 1 with changes
ok. let me think / let's see whether anyone else has thoughts
feel free to use @worktrunk-bot to fix tests etc
Re: X hidden, i did add that to the summary message- not sure if this is what you meant but it says ○ Showing 1 worktree, 4 ignored, 1 with changes
I was thinking "8 hidden" could be here
CI is failing because TestRepo::git_command() on main now returns worktrunk::shell_exec::Cmd (not std::process::Command), and Cmd has .run() but not .output().
The fix is in tests/integration_tests/list_config.rs lines 598 and 600 — change .output() to .run():
- .output();
+ .run();
}
- let _ = repo.git_command().args(["branch", "-D", branch]).output();
+ let _ = repo.git_command().args(["branch", "-D", branch]).run();
The check-unused-dependencies failure (tree-sitter) is a pre-existing issue on main — not related to this PR.
Re: X hidden, i did add that to the summary message- not sure if this is what you meant but it says ○ Showing 1 worktree, 4 ignored, 1 with changes
I was thinking "8 hidden" could be here
Right i added 'X ignored'. I can rename to 'X hidden' if you like
Right i added 'X ignored'.
sorry, not sure how I missed that!
@worktrunk-bot can we fix the tests, so we have a working PR to review?
Fixed — merged main and changed .output() → .run() on the two Cmd calls in list_config.rs (lines 598, 600). All 1266 integration tests pass and lints are clean.
@worktrunk-bot update dev/config.example.toml as suggested
@max-sixty any thoughts on this change?
Done — added ignore = ["tmp-*"] to the [list] section in the config docs source (src/cli/mod.rs), and regenerated all downstream files:
dev/config.example.toml(line 88)docs/content/config.mdskills/worktrunk/reference/config.md- Help text snapshots for
wt configandwt config create
@worktrunk-bot do we label as experimental? can we do that if not?
thanks @willpote
@worktrunk-bot can we review whether this should be ignore vs hidden? if we can switch to them etc, it should be "hidden"; it should only be "ignored" if we totally ignore it
Done — labeled [list].ignore as experimental. Added [experimental] tags to:
- The
## Filtering with ignore patternsdocs section heading - The
--ignoredCLI flag description - The
ignoreline in the config example TOML
All downstream files regenerated (docs, skills, help snapshots).
Reviewed the diff — the filtering only applies to wt list output. Worktrees matched by these patterns are still fully accessible for switch, merge, remove, and every other command. So this is display-level hiding, not functional ignoring.
Agree hidden is the right name. The rename would touch:
- Config field:
[list].ignore→[list].hidden - CLI flag:
--ignored→--hidden(or--show-hidden) - Docs/messages: "ignored" → "hidden" throughout (summary line, section headings, help text)
- Struct fields:
ignore/ignored→hiddeninListConfig,ShowConfig,SummaryMetrics,collect()
The glob::Pattern matching logic stays the same — just a naming change.
@willpote would you like to make this rename, or should I put up a commit on the branch?
@worktrunk-bot let's make the naming change and then if @willpote disagrees we can revert
Done — renamed [list].ignore → [list].hidden and --ignored → --hidden throughout:
- Config field, CLI flag, struct fields, variables, comments
- All 6 integration tests (renamed functions + snapshot files)
- Help text snapshots, docs, skill references, example configs
All 1339 integration tests + 492 unit tests pass, lints clean.
@worktrunk-bot merge and resolve conflicts
Merged main and resolved conflicts — main refactored List to use a ListArgs struct (along with Switch, Remove, Merge). Added the hidden field to ListArgs and updated the dispatch to pass it through. All 1393 integration tests pass, lints clean. Waiting on CI.