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

Specifying N revisions after the initial commit

From
JBJosh Boyer <jwboyer@gmail.com>
Date
Sep 22, 2015, 18:32 UTC
Message-ID
<CA+5PVA40x8bxW63X+b77FDO8btRBaVOg=fq+ZyX=bdJ+uEm9gA@mail.gmail.com>
Hi All,
Please CC me as I'm not subscribed.

I was hoping someone could help me with the revision shorthand to get the commit sha of a commit N commits after the initial commit. Thus far I've figured out that to get the initial commit in a repository, you can use:

git rev-list --max-parents=0 HEAD

but I can't figure out how to get "give me the commit sha1 of the commit immediately after the initial commit", or for some number N. I could always do something like:

git rev-list HEAD | tail -2

to get both, but I was curious if there was a refspec shorthand for this that could be used. It seems that git's rev parsing is all built on going backwards in order (and probably rightfully so).

Thanks in advance.
josh
Next: Konstantin Khomoutov
Message 1 of 7 in “Specifying N revisions after the initial commit”
  1. Josh BoyerSep 22, 2015
  2. Konstantin KhomoutovSep 22, 2015
  3. Josh BoyerSep 22, 2015
  4. Junio C HamanoSep 22, 2015
  5. Josh BoyerSep 22, 2015
  6. Theodore Ts'oSep 22, 2015
  7. Junio C HamanoSep 22, 2015

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.