{"thread":{"id":"61466","subject":"Options to have git log presents commits of a non linear history in a meaningful order","startedAt":"2024-05-13T21:37:05Z","lastAt":"2024-05-13T22:52:57Z","messageCount":2,"participants":["u34@net9.cf","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"494669","messageId":"E1s6cl5-0003nc-3D@mx1.net9.cf","threadId":"61466","inReplyTo":null,"subject":"Options to have git log presents commits of a non linear history in a meaningful order","fromName":"","fromEmail":"u34@net9.cf","sentAt":"2024-05-13T20:58:55Z","receivedAt":"2024-05-13T21:37:05Z","isPatch":false,"sender":{"key":"u34@net9.cf","avatar":null},"body":"Am I right by default, git log present commits of a non linear history in\na meaningles order? Am I right git log has options, such as --graph, to \nget the order of commits presented in a more meaningful way?\n\nAs of git 2.45.0, gittutorial states \n    \n   The git log command has a weakness: it must present commits in\n   a list. When the history has lines of development that\n   diverged and then merged back together, the order in which git\n   log presents those commits is meaningless.\n\nIs it accurate?\n\n--\nu34\n"},{"id":"494679","messageId":"xmqqmsotcojg.fsf@gitster.g","threadId":"61466","inReplyTo":"E1s6cl5-0003nc-3D@mx1.net9.cf","subject":"Re: Options to have git log presents commits of a non linear history in a meaningful order","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-05-13T22:52:51Z","receivedAt":"2024-05-13T22:52:57Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"u34@net9.cf writes:\n\n> Am I right by default, git log present commits of a non linear history in\n> a meaningles order? Am I right git log has options, such as --graph, to \n> get the order of commits presented in a more meaningful way?\n\nI wouldn't say --graph gives much meaningful ordering.  \n\nRather, \"--graph\" is a way to present the list of things that is\nfundamentally not an ordered list by giving an extra information\n(information that cannot be captured by orders alone) to make it\nvisually apparent in the output which ones form partial ordering\namong them.\n\nIf you have two branches, one has commits A and B and the other has\ncommits X, Y, and Z, since they forked, your history may look like:\n\n    o---A---B\n     \\\n      X---Y---Z\n\nand your command \"git log ^O B Z\" can present them in any order as\nlong as B is shown before A, Z is shown before Y and X, and Y is\nshown before X.  There is a partial ordering among the commits that\nare ancestors of B, and there is another partial ordering among the\ncommits that are ancestores of Z.  But there is no \"meaningful\"\nordering between sets (A, B) and (X, Y, Z).  This is especially true\nif the two branches were done by different people, perhaps in\ndifferent timezones, possibly with one of them using a wrong clock.\nTheir timestamps cannot tell you the relative ordering of the\ncommits across these two sets.\n\n> As of git 2.45.0, gittutorial states \n>     \n>    The git log command has a weakness: it must present commits in\n>    a list. When the history has lines of development that\n>    diverged and then merged back together, the order in which git\n>    log presents those commits is meaningless.\n>\n> Is it accurate?\n\nI wouldn't read the tutorial with such a fine toothed comb.  It is\ngood if it is filled with white lies to make the initial learning\nprocess smoother.  When it tells that users shouldn't read too much\ninto the ordering of commits, readers should just stick to what was\nsuggested.\n\n"}]}