git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Git log print commits between a revision range (inclusive)
@ 2019-03-04  7:28 wuzhouhui
  2019-03-04  7:30 ` wuzhouhui
  2019-03-04  7:54 ` Junio C Hamano
  0 siblings, 2 replies; 5+ messages in thread
From: wuzhouhui @ 2019-03-04  7:28 UTC (permalink / raw)
  To: git

Hi,

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>. So, how to display
logs between a revision range that both start and end are
inclusive?

Please CC me, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Git log print commits between a revision range (inclusive)
  2019-03-04  7:28 Git log print commits between a revision range (inclusive) wuzhouhui
@ 2019-03-04  7:30 ` wuzhouhui
  2019-03-04  7:54 ` Junio C Hamano
  1 sibling, 0 replies; 5+ messages in thread
From: wuzhouhui @ 2019-03-04  7:30 UTC (permalink / raw)
  To: git; +Cc: wanghui

> -----Original Messages-----
> From: wuzhouhui <wuzhouhui14@mails.ucas.ac.cn>
> Sent Time: 2019-03-04 15:28:13 (Monday)
> To: git@vger.kernel.org
> Cc: 
> Subject: Git log print commits between a revision range (inclusive)
> 
> Hi,
> 
> 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],

Sorry for forgetting paste the link of [1]:
[1] https://stackoverflow.com/questions/18595305/git-log-outputs-in-a-specific-revision-range

> which doesn't resolve my problem completely, because
> 
>   git log <older hash>..<newer hash>
> 
> doesn't contains the log of <older hash>. So, how to display
> logs between a revision range that both start and end are
> inclusive?
> 
> Please CC me, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Git log print commits between a revision range (inclusive)
  2019-03-04  7:28 Git log print commits between a revision range (inclusive) wuzhouhui
  2019-03-04  7:30 ` wuzhouhui
@ 2019-03-04  7:54 ` Junio C Hamano
  2019-03-05 23:42   ` Rafael Ascensão
  1 sibling, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2019-03-04  7:54 UTC (permalink / raw)
  To: wuzhouhui; +Cc: git

wuzhouhui <wuzhouhui14@mails.ucas.ac.cn> writes:

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








^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Git log print commits between a revision range (inclusive)
  2019-03-04  7:54 ` Junio C Hamano
@ 2019-03-05 23:42   ` Rafael Ascensão
  2019-03-05 23:52     ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Rafael Ascensão @ 2019-03-05 23:42 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: wuzhouhui, Git Mailing List

As Junio mentioned, "A..B" means all commits reachable from B except those
reachable from A. Understanding this is just a way to say "B --not A" is
important to know you can take advantage of:

`--boundary`
    Output excluded boundary commits. Boundary commits are prefixed with -.

In other words, git log --boundary <older hash>..<newer hash> should give you
exactly what you asked with the small caveat it marks excluded commits
differently.


Cheers,
Rafael Ascensão

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Git log print commits between a revision range (inclusive)
  2019-03-05 23:42   ` Rafael Ascensão
@ 2019-03-05 23:52     ` Junio C Hamano
  0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2019-03-05 23:52 UTC (permalink / raw)
  To: Rafael Ascensão; +Cc: wuzhouhui, Git Mailing List

Rafael Ascensão <rafa.almas@gmail.com> writes:

> As Junio mentioned, "A..B" means all commits reachable from B except those
> reachable from A. Understanding this is just a way to say "B --not A" is
> important to know you can take advantage of:
>
> `--boundary`
>     Output excluded boundary commits. Boundary commits are prefixed with -.
>
> In other words, git log --boundary <older hash>..<newer hash> should give you
> exactly what you asked with the small caveat it marks excluded commits
> differently.

You are correct, but only when dealing with a single strand of
pearls.  If the history leading to <newer> is bushy with merges, the
above will give _far_ more than what was requested.  The fork points
of the side branches that got merged during <old>..<new> will also
be shown, in addition to the <old>.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-05 23:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-04  7:28 Git log print commits between a revision range (inclusive) wuzhouhui
2019-03-04  7:30 ` wuzhouhui
2019-03-04  7:54 ` Junio C Hamano
2019-03-05 23:42   ` Rafael Ascensão
2019-03-05 23:52     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).