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

Re: git log --graph with a sort of local revision number

From
Rafael Ascensão <rafa.almas@gmail.com>
Date
Aug 18, 2019, 19:00 UTC
Message-ID
<20190818190032.GA11185@rigel>
In-Reply-To
<87blwq7rn5.fsf@mat.ucm.es>
You can achieve something close (on small repos, more on that later) with:
$ git log --graph --color \
  --format='%C(auto)changeset: %h:%H%nuser:      %an%ndate:      %ad%nsummary:   %s%n' \
  | git name-rev --refs=$(git rev-parse --abbrev-ref HEAD) --name-only --stdin
    * changeset: 5fa0f52:master
    | user:      Junio C Hamano
    | date:      Fri Aug 16 10:28:23 2019 -0700
    | summary:   Git 2.23
    |
    *   changeset: 8e0fa0e:master~1
    |\  user:      Junio C Hamano
    | | date:      Fri Aug 16 10:22:51 2019 -0700
    | | summary:   Merge tag 'l10n-2.23.0-rnd2' of git://github.com/git-l10n/git-po
    | | 
    | * changeset: a6cd2cc:master~1^2
    | | user:      Jiang Xin
    | | date:      Tue Jul 30 10:02:22 2019 +0800
    | | summary:   l10n: zh_CN: for git v2.23.0 l10n round 1~2

And in this case, since we are using HEAD to describe the commits by using --refs=$(git rev-parse --abbrev-ref HEAD), you can refer to a6cd2cc either as master~1^2 or HEAD~1^2.

Now, git-name-rev has some memory/performance problems in repos with a high number of references. Alban Gruin was working on this issue[1], but I don't know what's the status of it.

[1]:https://github.com/agrn/git/tree/ag/fix-name-rev-leak
Previous: Uwe BrauerNext: Uwe Brauer
Message 2 of 13 in “git log --graph with a sort of local revision number”
  1. Uwe BrauerAug 15, 2019
  2. Rafael AscensãoAug 18, 2019
  3. Uwe BrauerAug 18, 2019
  4. Uwe BrauerAug 18, 2019
  5. [SOLVED] (was: git log --graph with a sort of local revision number)Uwe Brauer, Aug 18, 2019
  6. [problem with name-rev] (was: git log --graph with a sort of local revision number)Uwe Brauer, Aug 20, 2019
  7. SZEDER GáborAug 20, 2019
  8. Rafael AscensãoAug 20, 2019
  9. Junio C HamanoAug 20, 2019
  10. Uwe BrauerAug 20, 2019
  11. Phil HordAug 20, 2019
  12. Uwe BrauerAug 21, 2019
  13. Uwe BrauerAug 21, 2019

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.