On Wed, 20 Mar 2024 at 10:02, Jeff King <peff@xxxxxxxx> wrote: > > On Wed, Mar 20, 2024 at 08:00:00AM +0000, Matt Hickford wrote: > > > Hi. `git branch` lists branches. It highlights the current branch with > > an asterisk and (for me) the colour green. This is handy for quick > > reading. > > > > `git worktree list` lists worktrees. It would be neat to highlight the > > local worktree. > > > > Another idea: `git branch -v` shows the commit subject and > > ahead/behind counts for each branch, eg. "[ahead 1, behind 1] avoid > > RegexReplace". It would be neat for `git worktree list -v` (or > > similar) to show the commit subject and ahead/behind counts. > > I'm not sure if this is a dumb idea or not, but: what if git-branch > learned to display branches associated with worktrees (just like "-r" > lists remote branches, etc). > > Then you'd get the all of the display niceties you want, along with > other features like sorting, limiting by merge, etc. You can even show > the worktree paths with a custom format that uses %(worktreepath). > > I think the only thing it wouldn't do is show worktrees that are > detached from any branch at all. I'm not sure if that's important to > your workflow or not. I frequently run `git worktree list` to review my work in each tree. Or to choose an inactive tree for new work. Example output: E:/product1 ea601b57e (detached HEAD) E:/product2 b255bd1b6 [json] E:/product3 0d7623530 [optimise] E:/product4 7bf8297c7 (detached HEAD) E:/product5 a8f89cabc (detached HEAD) E:/product6 89a022651 [xml] The more information the better -- highlighting the local workspace, ref names when HEAD is detached: E:/product1 ea601b57e (detached HEAD, main) E:/product2 b255bd1b6 [json] E:/product3 0d7623530 [optimise] * E:/product4 7bf8297c7 (detached HEAD) E:/product5 a8f89cabc (detached HEAD, origin/random) E:/product6 89a022651 [xml] A verbose option with commit subjects and ahead-behind counts: E:/product1 ea601b57e (detached HEAD, main) Articulate splines E:/product2 b255bd1b6 [json] [ahead 1] Correct syntax error E:/product3 0d7623530 [optimise] Optimise algorithm * E:/product4 7bf8297c7 (detached HEAD) Reformat doc E:/product5 a8f89cabc (detached HEAD, origin/random) Seed random generator E:/product6 89a022651 [xml] Replace with XML