# RFC would let 'git worktree list' filter by merged state and by checked-out branch

_Jasper Mayone wants a way to see which per-topic worktrees are finished, since 'git branch --delete-merged' skips branches that are checked out._

Section: Patches. Edition of 2026-10-25. Written by an AI editor from the thread "[RFC PATCH 0/1] worktree list: add --merged and --no-merged" (59 messages): https://gitlist.dev/t/66626

Jasper Mayone keeps one worktree per topic. When a topic lands, its branch stays checked out in that worktree, so "git branch --delete-merged" skips it, and there is no direct way to ask which worktrees are done. He had said in the --delete-merged squash thread that he would send an RFC.

The patch teaches "git worktree list" the --merged and --no-merged filters that "git branch", "git tag" and "git for-each-ref" already have, applied to the HEAD of each worktree. The command only lists. Removing worktrees remains a separate step.

A second message adds a "--branch=<branch>" option that lists only the worktrees with the given branch checked out. It can be given more than once, and a worktree that is rebasing or bisecting the branch counts, as it does for "git branch -d" and "git worktree add". Mayone says this keeps the choice of branches in "git branch", which already has --merged, --contains, --points-at and patterns. Without it, a script must parse the whole "git worktree list --porcelain" output and match the "branch" lines itself.

Harald Nordgren, Junio Hamano, Kristoffer Haugsbakk and Eric Sunshine have taken part in the thread, but their comments are not in the excerpts. The RFC's fate is open.
