git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH 1/1] worktree list: add --merged and --no-merged

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 23, 2026, 18:30 UTC
Message-ID
<xmqqqzhg5kyd.fsf@gitster.g>
In-Reply-To
<20261021173350.67854-2-me@jaspermayone.com>
Jasper Mayone <me@jaspermayone.com> writes:
Show 6 quoted lines
> Users who keep one worktree per topic have no direct way to find the
> worktrees whose work has already landed. "git branch --merged" lists
> the branches, but the user then has to match each branch to a
> worktree by hand, and a detached worktree has no branch to match.
> "git branch --delete-merged" skips any branch that is checked out in
> a worktree, so these are exactly the branches it leaves behind.

Real review on this patch never happened, it seems, perhaps because a discussion on a side issue distracted everybody?

It looks like the intro unfairly narrows the problem space. Even for those users who do not use one worktree per topic do need to find worktrees based on what branch they check out. While I agree that among the criteria to choose these branches to filter worktrees on, "--merged" and "--not-merged" may be two of the most useful ones, the feature does not have to be limited to them.

I wonder if "git worktree list --branch=...", where --branch= can be given multiple times, is a better primitive? With that you could do something like

  $ git worktree list $(git branch --contains HEAD | sed -e 's/^/--branch=/')
to reuse the same machinery without any extra code.
Previous: Jasper MayoneNext: Eric Sunshine
Message 3 of 24 in “worktree list: add --merged and --no-merged”
  1. 0/1 worktree list: add --merged and --no-mergedJasper Mayone, Oct 21, 2026
  2. 1/1 worktree list: add --merged and --no-mergedJasper Mayone, Oct 21, 2026
  3. Junio C HamanoOct 23, 2026
  4. Eric SunshineOct 24, 2026
  5. worktree list: add --branch to select worktrees by branchJasper Mayone, Oct 24, 2026
  6. Phillip WoodOct 25, 2026
  7. Phillip WoodOct 26, 2026
  8. Eric SunshineOct 28, 2026
  9. Junio C HamanoOct 28, 2026
  10. Kristoffer HaugsbakkOct 28, 2026
  11. Jasper MayoneOct 29, 2026
  12. Eric SunshineOct 29, 2026
  13. Phillip WoodOct 29, 2026
  14. Ben KnobleOct 29, 2026
  15. Phillip WoodOct 29, 2026
  16. 0/2 worktree: treat a branch being rebased or bisected as checked outJasper Mayone, Oct 30, 2026
  17. 1/2 worktree remove: refuse a worktree in the middle of a rebase or bisectJasper Mayone, Oct 30, 2026
  18. 2/2 ref-filter: name the worktree of a branch being rebased or bisectedJasper Mayone, Oct 30, 2026
  19. Junio C HamanoOct 30, 2026
  20. Jasper MayoneOct 30, 2026
  21. Harald NordgrenOct 21, 2026
  22. Junio C HamanoOct 21, 2026
  23. Harald NordgrenOct 22, 2026
  24. Kristoffer HaugsbakkOct 22, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.