{"thread":{"id":"6915","subject":"How to say HEAD~\"all the way back - 1\"","startedAt":"2007-02-22T19:17:17Z","lastAt":"2007-02-24T09:30:18Z","messageCount":10,"participants":["Bill Lear","Petr Baudis","Junio C Hamano","J. Bruce Fields","Johannes Schindelin","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"35251","messageId":"17885.60477.53356.123095@lisa.zopyra.com","threadId":"6915","inReplyTo":null,"subject":"How to say HEAD~\"all the way back - 1\"","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-22T19:17:17Z","receivedAt":"2007-02-22T19:17:17Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"Git \"indexing\" of commits has a way to \"go back\":\n\n% git diff HEAD~3\n\nCan I say \"all the way back\", or \"all the way back - 1\" somehow?\n\n\nBill\n"},{"id":"35254","messageId":"20070222193625.GA4489@pasky.or.cz","threadId":"6915","inReplyTo":"17885.60477.53356.123095@lisa.zopyra.com","subject":"Re: How to say HEAD~\"all the way back - 1\"","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2007-02-22T19:36:25Z","receivedAt":"2007-02-22T19:36:25Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Thu, Feb 22, 2007 at 08:17:17PM CET, Bill Lear wrote:\n> Git \"indexing\" of commits has a way to \"go back\":\n> \n> % git diff HEAD~3\n> \n> Can I say \"all the way back\", or \"all the way back - 1\" somehow?\n\nWhat would that mean? :)\n\nDo you mean to the \"root\" of the history? The trouble is, there can be\nmany of such roots (coming up from merges of previously disjunct\nhistories); even the git project itself has several. Which one to\nchoose?\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nThe meaning of Stonehenge in Traflamadorian, when viewed from above, is:\n\"Replacement part being rushed with all possible speed.\"\n\t\t-- Kurt Vonnegut, Sirens from Titan\n"},{"id":"35258","messageId":"7vodnmdk8y.fsf@assigned-by-dhcp.cox.net","threadId":"6915","inReplyTo":"17885.60477.53356.123095@lisa.zopyra.com","subject":"Re: How to say HEAD~\"all the way back - 1\"","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-22T20:12:45Z","receivedAt":"2007-02-22T20:12:45Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bill Lear <rael@zopyra.com> writes:\n\n> Git \"indexing\" of commits has a way to \"go back\":\n>\n> % git diff HEAD~3\n>\n> Can I say \"all the way back\", or \"all the way back - 1\" somehow?\n\nSorry, there is no such shorthand, but you could obviously say:\n\n\t$ git rev-list --parents HEAD | grep -v ' '\n\nA way to find the root commit seems to be one of the things\npeople new to git want at least once, once they start futzing\nwith the tool.  But I suspect that is only because they need\nthat information to see how the tool works (say \"what different\noutput would I get out of 'git show $commit' for root and other\ncommits?\"), and not because they need that information for any\nreal life use.\n\nReally, what useful purpose does it serve for you to find out\nthe root commit, OTHER THAN being able to say \"the development\nhistory of this project starts at this commit\"?\n"},{"id":"35259","messageId":"17885.64501.15547.465411@lisa.zopyra.com","threadId":"6915","inReplyTo":"7vodnmdk8y.fsf@assigned-by-dhcp.cox.net","subject":"Re: How to say HEAD~\"all the way back - 1\"","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-22T20:24:21Z","receivedAt":"2007-02-22T20:24:21Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Thursday, February 22, 2007 at 12:12:45 (-0800) Junio C Hamano writes:\n>Bill Lear <rael@zopyra.com> writes:\n>\n>> Git \"indexing\" of commits has a way to \"go back\":\n>>\n>> % git diff HEAD~3\n>>\n>> Can I say \"all the way back\", or \"all the way back - 1\" somehow?\n>\n>Sorry, there is no such shorthand, but you could obviously say:\n>\n>\t$ git rev-list --parents HEAD | grep -v ' '\n>\n>A way to find the root commit seems to be one of the things\n>people new to git want at least once, once they start futzing\n>with the tool.  But I suspect that is only because they need\n>that information to see how the tool works (say \"what different\n>output would I get out of 'git show $commit' for root and other\n>commits?\"), and not because they need that information for any\n>real life use.\n>\n>Really, what useful purpose does it serve for you to find out\n>the root commit, OTHER THAN being able to say \"the development\n>history of this project starts at this commit\"?\n\nJust today, I got a bug report from one of our developers.\nThe git update hook we had in place before the conversion\nto 1.5 had this:\n\nchmod -R ug+w $GIT_DIR\n\nto avoid problems when people used 'git ssh://...\", due to\ndifferent umasks (yeah, a hack).\n\nSo, moving to 1.5, I updated our script (and, had been updating it for\nquite some time, so many revisions, maybe 20 or so), and well,\nnow when people use ssh, they leave behind directories others\ncan't read (as git now allows push through \"git://\", we'll be\nweaning people off of ssh soon).\n\nSo, I wanted to say \"give me the first version of this, so I\ncan cut-n-paste the chmod command, since I can't remember if it\nwas chmod, or chown, or some combination ...\", and thus the desire\nto to:\n\n% git log -p HEAD~\"All the way back\" update\n\nor something similar.\n\n\nBill\n"},{"id":"35265","messageId":"20070222204737.GC18622@fieldses.org","threadId":"6915","inReplyTo":"7vodnmdk8y.fsf@assigned-by-dhcp.cox.net","subject":"Re: How to say HEAD~\"all the way back - 1\"","fromName":"J. Bruce Fields","fromEmail":"bfields@fieldses.org","sentAt":"2007-02-22T20:47:37Z","receivedAt":"2007-02-22T20:47:37Z","isPatch":false,"sender":{"key":"bfields@citi.umich.edu","avatar":null},"body":"On Thu, Feb 22, 2007 at 12:12:45PM -0800, Junio C Hamano wrote:\n> Sorry, there is no such shorthand, but you could obviously say:\n> \n> \t$ git rev-list --parents HEAD | grep -v ' '\n> \n> A way to find the root commit seems to be one of the things\n> people new to git want at least once, once they start futzing\n> with the tool.  But I suspect that is only because they need\n> that information to see how the tool works (say \"what different\n> output would I get out of 'git show $commit' for root and other\n> commits?\"), and not because they need that information for any\n> real life use.\n> \n> Really, what useful purpose does it serve for you to find out\n> the root commit, OTHER THAN being able to say \"the development\n> history of this project starts at this commit\"?\n\nI occasionally want to reference commits not relative to \"all the way\nback\" but to \"all the way back on this branch\".  So, e.g., what's the\nnext-to-last commit before \"topic\" meets up with \"origin\"?\n\nI can do something like\n\n\tgit rev-list origin..topic | tail -2 | head -1\n\nbut in practice it's faster just to fire up gitk origin.. and\ncut-n-paste object id's.\n\n--b.\n"},{"id":"35268","messageId":"Pine.LNX.4.63.0702222153010.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6915","inReplyTo":"20070222204737.GC18622@fieldses.org","subject":"Re: How to say HEAD~\"all the way back - 1\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-22T20:53:57Z","receivedAt":"2007-02-22T20:53:57Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 22 Feb 2007, J. Bruce Fields wrote:\n\n> I can do something like\n> \n> \tgit rev-list origin..topic | tail -2 | head -1\n> \n> but in practice it's faster just to fire up gitk origin.. and\n> cut-n-paste object id's.\n\nOr something like\n\n\tgit rev-list --reverse origin..topic | sed -n 2p\n\nBut that's even longer! (Although conceptually shorter...)\n\nCiao,\nDscho\n"},{"id":"35270","messageId":"7vr6shdi38.fsf@assigned-by-dhcp.cox.net","threadId":"6915","inReplyTo":"17885.64501.15547.465411@lisa.zopyra.com","subject":"Re: How to say HEAD~\"all the way back - 1\"","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-22T20:59:23Z","receivedAt":"2007-02-22T20:59:23Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bill Lear <rael@zopyra.com> writes:\n\n> % git log -p HEAD~\"All the way back\" update\n>\n> or something similar.\n\nBut in that use case \"root\" commit is not necessarily what you\nwanted to say, isn't it?  It is more like \"I want *earlier*\nhistory, not latest ones as the command usually gives, of this\nfile\".\n\n$ git log --reverse -p HEAD -- update\n\nwould give you the changes that touch the path in the reverse\norder than usual (I think this was merged post 1.5.0).\n\nBut my point is, you may happen to know it was in your root\ncommit, but that is a special case.  You may happen to know\nother things to limit the output.  The timeperiod you made that\nchange (e.g. --until=2006-05-31), for example.\n\nBy the way, on the face of it:\n\n$ git log --reverse -4 -p HEAD -- update\n\n(or whatever number of commits you are interested in viewing)\nmight be closer to what you want to express, but the --reverse\noption does not work like that, unfortunately for this\nparticular use case, because the way the semantics of\ninteraction between --reverse and --max-count is defined.\n\nGiven the above command line, the current implementation limits\nthe traversal to four items and then reverses the output,\ninstead of traversing normally as if --max-count limitation is\nnot there, reversing the result and then limiting the output to\nfour items, which would have made the sample command line above\na bit more useful.\n\nBut I would recommend against changing it.  Being able to view\nthe latest four commits in reverse is much more useful in\npractice than being able to view the four commits at the\nbeginning of time in reverse.  Having both options is certainly\na possibility but I doubt it is worth it.\n"},{"id":"35335","messageId":"ern9gn$h4d$1@sea.gmane.org","threadId":"6915","inReplyTo":"20070222193625.GA4489@pasky.or.cz","subject":"Re: How to say HEAD~\"all the way back - 1\"","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-02-23T17:52:22Z","receivedAt":"2007-02-23T17:52:22Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Petr Baudis wrote:\n\n> On Thu, Feb 22, 2007 at 08:17:17PM CET, Bill Lear wrote:\n>> Git \"indexing\" of commits has a way to \"go back\":\n>> \n>> % git diff HEAD~3\n>> \n>> Can I say \"all the way back\", or \"all the way back - 1\" somehow?\n> \n> What would that mean? :)\n> \n> Do you mean to the \"root\" of the history? The trouble is, there can be\n> many of such roots (coming up from merges of previously disjunct\n> histories); even the git project itself has several. Which one to\n> choose?\n\nActually HEAD~n follows first parent, so it would be only one such root.\n\nThe git project has 4 or 5 roots for mainline + 3 separate disjoint \nbranches with separate roots (html, man, todo).\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"35336","messageId":"17887.10938.419368.304761@lisa.zopyra.com","threadId":"6915","inReplyTo":"ern9gn$h4d$1@sea.gmane.org","subject":"Re: How to say HEAD~\"all the way back - 1\"","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-23T17:56:10Z","receivedAt":"2007-02-23T17:56:10Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Friday, February 23, 2007 at 18:52:22 (+0100) Jakub Narebski writes:\n>Petr Baudis wrote:\n>\n>> On Thu, Feb 22, 2007 at 08:17:17PM CET, Bill Lear wrote:\n>>> Git \"indexing\" of commits has a way to \"go back\":\n>>> \n>>> % git diff HEAD~3\n>>> \n>>> Can I say \"all the way back\", or \"all the way back - 1\" somehow?\n>> \n>> What would that mean? :)\n>> \n>> Do you mean to the \"root\" of the history? The trouble is, there can be\n>> many of such roots (coming up from merges of previously disjunct\n>> histories); even the git project itself has several. Which one to\n>> choose?\n>\n>Actually HEAD~n follows first parent, so it would be only one such root.\n\nExactly what I was after.  Something like:\n\n% git diff HEAD~-1\n\nor\n\n% git diff ^HEAD~0\n\nwhatever ...\n\n\nBill\n"},{"id":"35388","messageId":"7virdrzyvp.fsf@assigned-by-dhcp.cox.net","threadId":"6915","inReplyTo":"17887.10938.419368.304761@lisa.zopyra.com","subject":"Re: How to say HEAD~\"all the way back - 1\"","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-24T09:30:18Z","receivedAt":"2007-02-24T09:30:18Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bill Lear <rael@zopyra.com> writes:\n\n> Exactly what I was after.  Something like:\n>\n> % git diff HEAD~-1\n>\n> or\n>\n> % git diff ^HEAD~0\n>\n> whatever ...\n\n<amusement>\n\n        $ git rev-parse HEAD~4096\n        fatal: ambiguous argument 'HEAD~4096': unknown revision or path ...\n        $ git rev-parse HEAD~2048\n        231af8322...\n        $ git rev-parse HEAD~3072\n        723c31fea...\n        $ git rev-parse HEAD~3584\n        ....\n        $ git rev-parse HEAD_3952\n        e83c5163316f89bfbde7d9ab23ca2e25604af290\n\n</amusement>\n\nIf you somehow need to know where the root is all the time, you\ncould do the above once and say:\n\n\t$ git tag root-commit e83c5163316f89bfbde7d9ab23ca2e25604af290\n"}]}