From: "Rubén Justo" <rjusto@gmail.com>
To: Matt Hickford <matt.hickford@gmail.com>,
Git Mailing List <git@vger.kernel.org>
Cc: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>
Subject: Re: Feature request: highlight local worktree in `worktree list`
Date: Wed, 20 Mar 2024 23:24:08 +0100 [thread overview]
Message-ID: <63dda239-1205-4aae-a3b2-10365147751c@gmail.com> (raw)
In-Reply-To: <CAGJzqsmy9RcWJeFLkZjCrrhv_y5q_R3yYUMhcyafY3jOUJFxOg@mail.gmail.com>
On Wed, Mar 20, 2024 at 08:00:00 +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.
Both ideas sound good. And so do what Peff has suggested.
I want to point out that maybe "git branch [--list] -v -v" has gone
unnoticed. It does not fully meet the expectations expressed in this
thread, but perhaps it can be of some help:
$ git init -b foo /tmp/main
Initialized empty Git repository in /tmp/main/.git/
$ cd /tmp/main
$ git commit --allow-empty -m test
[foo (root-commit) 87382f1] test
$ git worktree add ../wt
Preparing worktree (new branch 'wt')
HEAD is now at 87382f1 test
$ git branch --set-upstream-to=wt
Branch 'foo' set up to track local branch 'wt'.
$ cd /tmp/wt
$ git branch -v -v
+ foo 87382f1 (/tmp/main) [wt] test
* wt 87382f1 test
$ git commit --allow-empty -m test_2
[wt df39c54] test_2
$ git branch -v -v
+ foo 87382f1 (/tmp/main) [wt: behind 1] test
* wt df39c54 test_2
"git branch --list" has a much richer machinery than "git worktree list".
Perhaps the display machinery of both commands can converge in some way.
next prev parent reply other threads:[~2024-03-20 22:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-20 8:00 Feature request: highlight local worktree in `worktree list` Matt Hickford
2024-03-20 10:02 ` Jeff King
2024-03-20 14:38 ` Junio C Hamano
2024-03-20 20:39 ` Jeff King
2024-03-21 13:00 ` Matt Hickford
2024-03-20 22:24 ` Rubén Justo [this message]
2024-03-21 0:53 ` Chris Torek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=63dda239-1205-4aae-a3b2-10365147751c@gmail.com \
--to=rjusto@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=matt.hickford@gmail.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).