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

Re: Git log print commits between a revision range (inclusive)

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 4, 2019, 07:54 UTC
Message-ID
<xmqq8sxvvzvg.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<62307e7b.399f4.169479a611e.Coremail.wuzhouhui14@mails.ucas.ac.cn>
wuzhouhui <wuzhouhui14@mails.ucas.ac.cn> writes:
Show 7 quoted lines
> I want to know how to display logs between a revision range (both
> start and end are inclusive). I searched it and only found[1],
> which doesn't resolve my problem completely, because
>
>   git log <older hash>..<newer hash>
>
> doesn't contains the log of <older hash>.
 $ git log maint --not v2.20.0^@

gives you commits that are reachable from (i.e. ancestors of) maint, excluding those that are reachable from the set of commits denoted by v2.20.0^@.

v2.20.0^@ is how you spell the set of commits that are parents of the commit v2.20.0.

If your "range" is simple and "old" is a single-parent commit,
 $ git log <old>~1..<new>

is equivalent, because <old>~1 (i.e. the first parent of commit <old>) would be the same as <old>^@ for a single-parent commit, and because the short-hand "git log A..B" is the same as the long-hand "git log B --not A".

Previous: wuzhouhuiNext: Rafael Ascensão
Message 3 of 5 in “Git log print commits between a revision range (inclusive)”
  1. wuzhouhuiMar 4, 2019
  2. wuzhouhuiMar 4, 2019
  3. Junio C HamanoMar 4, 2019
  4. Rafael AscensãoMar 5, 2019
  5. Junio C HamanoMar 5, 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.