From: Phillip Wood Date: Mon, 26 Oct 2026 11:02:12 GMT Subject: Re: [PATCH v2] worktree list: add --branch to select worktrees by branch Message-ID: <74ba33b2-60f6-40cf-86e9-dac95876b1be@gmail.com> In-Reply-To: One further thought ... On 25/10/2026 14:47, Phillip Wood wrote: > On 24/10/2026 17:53, Jasper Mayone wrote: > >> For example, to list >> the worktrees whose branch is merged into origin/main: >> >>      git worktree list \ >>     $(git branch --format='--branch=%(refname)' --merged origin/main) >> >> The --format is needed because the default output of "git branch" >> marks the current branch with "*" and the branches checked out in >> other worktrees with "+". It uses the full name because >> %(refname:short) gives "heads/topic" when a tag is also called >> "topic". I think you can use "%(refname:lstrip=2)" to always remove "refs/heads/" which means we could simplify the implementation and just accept branch names. Thanks Phillip