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

Re: How to say HEAD~"all the way back - 1"

From
Junio C Hamano <junkio@cox.net>
Date
Feb 22, 2007, 20:59 UTC
Message-ID
<7vr6shdi38.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<17885.64501.15547.465411@lisa.zopyra.com>
Bill Lear <rael@zopyra.com> writes:
> % git log -p HEAD~"All the way back" update
>
> or something similar.

But in that use case "root" commit is not necessarily what you wanted to say, isn't it? It is more like "I want *earlier* history, not latest ones as the command usually gives, of this file".

$ git log --reverse -p HEAD -- update

would give you the changes that touch the path in the reverse order than usual (I think this was merged post 1.5.0).

But my point is, you may happen to know it was in your root commit, but that is a special case. You may happen to know other things to limit the output. The timeperiod you made that change (e.g. --until=2006-05-31), for example.

By the way, on the face of it:
$ git log --reverse -4 -p HEAD -- update

(or whatever number of commits you are interested in viewing) might be closer to what you want to express, but the --reverse option does not work like that, unfortunately for this particular use case, because the way the semantics of interaction between --reverse and --max-count is defined.

Given the above command line, the current implementation limits the traversal to four items and then reverses the output, instead of traversing normally as if --max-count limitation is not there, reversing the result and then limiting the output to four items, which would have made the sample command line above a bit more useful.

But I would recommend against changing it. Being able to view the latest four commits in reverse is much more useful in practice than being able to view the four commits at the beginning of time in reverse. Having both options is certainly a possibility but I doubt it is worth it.

Previous: Bill LearNext: J. Bruce Fields
Message 8 of 10 in “How to say HEAD~"all the way back - 1"”
  1. Bill LearFeb 22, 2007
  2. Petr BaudisFeb 22, 2007
  3. Jakub NarebskiFeb 23, 2007
  4. Bill LearFeb 23, 2007
  5. Junio C HamanoFeb 24, 2007
  6. Junio C HamanoFeb 22, 2007
  7. Bill LearFeb 22, 2007
  8. Junio C HamanoFeb 22, 2007
  9. J. Bruce FieldsFeb 22, 2007
  10. Johannes SchindelinFeb 22, 2007

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.