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 24, 2007, 09:30 UTC
Message-ID
<7virdrzyvp.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<17887.10938.419368.304761@lisa.zopyra.com>
Bill Lear <rael@zopyra.com> writes:
Show 9 quoted lines
> Exactly what I was after.  Something like:
>
> % git diff HEAD~-1
>
> or
>
> % git diff ^HEAD~0
>
> whatever ...
<amusement>
        $ git rev-parse HEAD~4096
        fatal: ambiguous argument 'HEAD~4096': unknown revision or path ...
        $ git rev-parse HEAD~2048
        231af8322...
        $ git rev-parse HEAD~3072
        723c31fea...
        $ git rev-parse HEAD~3584
        ....
        $ git rev-parse HEAD_3952
        e83c5163316f89bfbde7d9ab23ca2e25604af290
</amusement>

If you somehow need to know where the root is all the time, you could do the above once and say:

	$ git tag root-commit e83c5163316f89bfbde7d9ab23ca2e25604af290
Previous: Bill LearNext: Junio C Hamano
Message 5 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.