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".