git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Options to have git log presents commits of a non linear history in a meaningful order
@ 2024-05-13 20:58 u34
  2024-05-13 22:52 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: u34 @ 2024-05-13 20:58 UTC (permalink / raw)
  To: git

Am I right by default, git log present commits of a non linear history in
a meaningles order? Am I right git log has options, such as --graph, to 
get the order of commits presented in a more meaningful way?

As of git 2.45.0, gittutorial states 
    
   The git log command has a weakness: it must present commits in
   a list. When the history has lines of development that
   diverged and then merged back together, the order in which git
   log presents those commits is meaningless.

Is it accurate?

--
u34

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

* Re: Options to have git log presents commits of a non linear history in a meaningful order
  2024-05-13 20:58 Options to have git log presents commits of a non linear history in a meaningful order u34
@ 2024-05-13 22:52 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2024-05-13 22:52 UTC (permalink / raw)
  To: u34; +Cc: git

u34@net9.cf writes:

> Am I right by default, git log present commits of a non linear history in
> a meaningles order? Am I right git log has options, such as --graph, to 
> get the order of commits presented in a more meaningful way?

I wouldn't say --graph gives much meaningful ordering.  

Rather, "--graph" is a way to present the list of things that is
fundamentally not an ordered list by giving an extra information
(information that cannot be captured by orders alone) to make it
visually apparent in the output which ones form partial ordering
among them.

If you have two branches, one has commits A and B and the other has
commits X, Y, and Z, since they forked, your history may look like:

    o---A---B
     \
      X---Y---Z

and your command "git log ^O B Z" can present them in any order as
long as B is shown before A, Z is shown before Y and X, and Y is
shown before X.  There is a partial ordering among the commits that
are ancestors of B, and there is another partial ordering among the
commits that are ancestores of Z.  But there is no "meaningful"
ordering between sets (A, B) and (X, Y, Z).  This is especially true
if the two branches were done by different people, perhaps in
different timezones, possibly with one of them using a wrong clock.
Their timestamps cannot tell you the relative ordering of the
commits across these two sets.

> As of git 2.45.0, gittutorial states 
>     
>    The git log command has a weakness: it must present commits in
>    a list. When the history has lines of development that
>    diverged and then merged back together, the order in which git
>    log presents those commits is meaningless.
>
> Is it accurate?

I wouldn't read the tutorial with such a fine toothed comb.  It is
good if it is filled with white lies to make the initial learning
process smoother.  When it tells that users shouldn't read too much
into the ordering of commits, readers should just stick to what was
suggested.


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

end of thread, other threads:[~2024-05-13 22:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-13 20:58 Options to have git log presents commits of a non linear history in a meaningful order u34
2024-05-13 22: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).