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

Re: Improving git branch

From
John Tapsell <johnflux@gmail.com>
Date
Dec 17, 2014, 11:51 UTC
Message-ID
<CAHQ6N+pjT9zCdbvjJnFTmJEM=btjDxn8LTRV-j1vbqGfqwks5A@mail.gmail.com>
In-Reply-To
<549168DD.1080906@drmicha.warpmail.net>

I don't fully understand - if I did that, then what difference would an average user actually see?

On 17 December 2014 at 11:28, Michael J Gruber <git@drmicha.warpmail.net> wrote:
Show 63 quoted lines
> John Tapsell schrieb am 17.12.2014 um 12:10:
>> Hi all,
>>
>>   I'm interested in putting in some time and effort into improving the
>> output of "git branch".
>>
>>   What I'm thinking is an output like this:
>>
>> $ git branch
>>
>> 2014-12-17 * (detached from origin/master)     deaba04 Do stuff
>> 2014-12-15   john.ta/add_timing_info                6edbcfa  Add timing stuff
>> 2014-12-14   master                                          8537316
>> [origin/master: ahead 1, behind 16] Some stuff
>> 2014-12-12   john.ta/new_reduce_memory       99d84db Reintroduce: memory stuff
>> 2014-12-05   john.ta/bugfixes                            e15c95e Add stuff
>> 2014-12-03   john.ta/container                           e9fd4e5 This
>> branch is a test bed for containers
>>
>>
>> (These columns are supposed to be all aligned nicely..)
>>
>> So, features:
>>
>> 1. Show the date of the last commit
>> 2. Sort by date.  Most recently used branches at the top
>> 3. Show the branch name, including your current "branch", with a * to
>> indicate that it's checked out.
>> 4. Show the sha
>> 5. Show the branch DESCRIPTION - and if that's not available, show the
>> short-line of the most recent commit.
>>
>> There is also a small amount of color here that I can't paste here, to
>> follow the coloring in the current git branch.
>>
>> Before I start making patches etc, what do people think?  Would I have
>> a chance of getting this in?  Should I change some aspects etc?
>>
>> Thanks,
>>
>> John Tapsell
>>
>
> I support the general goal, we have quite some way to go there.
>
> As to the method: "git branch" in list mode, "git tag" in list mode and
> "git for-each-ref" all do similar things and are in turn not dissimilar
> from "git log --no-walk" with appropriate formatting and rev options.
>
> Rather than extending "git branch" any further[*], I suggest a bolder
> strategy:
>
> - unify/merge for-each-ref and pretty formats (and code) as far as possible
> - leverage that for the list modes of branch and tag
>
> That would allow everyone to get their favourite listing, just like for
> logs. Otherwise it would be very difficult to agree on *the* proper
> format for an extended branch or tag list.
>
> Michael
>
>
> [*] I know I'm a sinner, too.
Previous: Michael J GruberNext: Michael J Gruber
Message 3 of 9 in “Improving git branch”
  1. John TapsellDec 17, 2014
  2. Michael J GruberDec 17, 2014
  3. John TapsellDec 17, 2014
  4. Michael J GruberDec 17, 2014
  5. Junio C HamanoDec 17, 2014
  6. Jeff KingDec 17, 2014
  7. Moritz NeebDec 21, 2014
  8. Michael J GruberDec 18, 2014
  9. Junio C HamanoDec 17, 2014

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.