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

Re: Any way to make git-log to enumerate commits?

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 7, 2018, 00:12 UTC
Message-ID
<xmqqr2eu8aaa.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20181206114835.oro32chgf4qp2yqd@tigra>
Konstantin Khomoutov <kostix@bswap.ru> writes:
Show 7 quoted lines
>> I do not see why the "name each rev relative to HEAD" formatting
>> option cannot produce HEAD^2~2 etc.
>>  ...
> My reading was that the OP explicitly wanted to just glance at a single
> integer number and use it right away in a subsequent rebase command.
>
> I mean, use one's own short memory instead of copying and pasting.

As everybody pointed out, a single integer number will fundamentally unworkable with distributed nature of Git that inherently makes the history with forks and merges. Besides, there is no way to feed "git log" with "a single integer number", without which "making git-log to enumerate" would not be all that useful ("git show HEAD~4" works but "git show 4" does not).

All of these name-rev based suggestions were about using anchoring point with memorable name plus a short path to reach from there, which I think is the closest thing to "a single integer number" and still is usable for the exact purpose. "HEAD~48^2" on an integration branch would be "the tip of the side branch that was merged some 48 commits ago", for example.

Previous: Konstantin Khomoutov
Message 7 of 7 in “Any way to make git-log to enumerate commits?”
  1. Konstantin KharlamovDec 5, 2018
  2. Konstantin KhomoutovDec 5, 2018
  3. Elijah NewrenDec 5, 2018
  4. Andreas SchwabDec 5, 2018
  5. Junio C HamanoDec 6, 2018
  6. Konstantin KhomoutovDec 6, 2018
  7. Junio C HamanoDec 7, 2018

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.