{"thread":{"id":"16895","subject":"user manual question","startedAt":"2008-12-28T07:26:52Z","lastAt":"2008-12-29T19:30:21Z","messageCount":12,"participants":["Zorba","Sitaram Chamarty","Dilip M","Björn Steinbrink","Markus Heidelberg","Daniel Barkalow"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"98834","messageId":"gj7mmo$fvk$4@ger.gmane.org","threadId":"16895","inReplyTo":null,"subject":"user manual question","fromName":"Zorba","fromEmail":"cr@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-28T07:26:52Z","isPatch":false,"sender":{"key":"cr@altmore.co.uk","avatar":null},"body":"Under \"Examining an old version without creating a new branch\" subsection in \nchapter1\n\nto aid my understanding, could the statement:\n\n\"The HEAD then refers to the SHA1 of the commit instead of to a branch, and \ngit branch shows that you are no longer on a branch:\"\n\nbe restated more explicitly as:\n\n\"The HEAD then refers to the SHA1 of the commit instead of to a branch head, \nand git branch shows that you are no longer on a branch head:\"\n\n?\n"},{"id":"98840","messageId":"slrnglf3qh.c7j.sitaramc@sitaramc.homelinux.net","threadId":"16895","inReplyTo":"gj7mmo$fvk$4@ger.gmane.org","subject":"Re: user manual question","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2008-12-28T14:38:09Z","receivedAt":"2008-12-28T14:38:09Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On 2008-12-28, Zorba <cr@altmore.co.uk> wrote:\n> Under \"Examining an old version without creating a new branch\" subsection in \n> chapter1\n>\n> to aid my understanding, could the statement:\n>\n> \"The HEAD then refers to the SHA1 of the commit instead of to a branch, and \n> git branch shows that you are no longer on a branch:\"\n>\n> be restated more explicitly as:\n>\n> \"The HEAD then refers to the SHA1 of the commit instead of to a branch head, \n> and git branch shows that you are no longer on a branch head:\"\n\nSure, but I prefer \"tip\"; reduces confusion between \"head\"\nand \"HEAD\" in spoken descriptions (I teach internal classes\non git occasionally, once even on a conf call!)\n\nThe git glossary makes no mention of \"tip\", so this is\nprobably \"unblessed\" :-)\n"},{"id":"98841","messageId":"c94f8e120812280836j4acab974s5139167ac6be54ee@mail.gmail.com","threadId":"16895","inReplyTo":"slrnglf3qh.c7j.sitaramc@sitaramc.homelinux.net","subject":"Re: user manual question","fromName":"Dilip M","fromEmail":"dilipm79@gmail.com","sentAt":"2008-12-28T16:36:56Z","receivedAt":"2008-12-28T16:36:56Z","isPatch":false,"sender":{"key":"dilipm79@gmail.com","avatar":"https://gravatar.com/avatar/9417e308513ce9251de2802a026c72eb164e6c9b9d7143a3ee13f6ed0c4d1bd5?d=mp&s=160"},"body":"On Sun, Dec 28, 2008 at 8:08 PM, <sitaramc@gmail.com> wrote:\n> On 2008-12-28, Zorba <cr@altmore.co.uk> wrote:\n>> Under \"Examining an old version without creating a new branch\"\n>> subsection in chapter1\n>>\n>> to aid my understanding, could the statement:\n>>\n>> \"The HEAD then refers to the SHA1 of the commit instead of to a\n>> branch, and git branch shows that you are no longer on a branch:\"\n>>\n>> be restated more explicitly as:\n>>\n>> \"The HEAD then refers to the SHA1 of the commit instead of to a\n>> branch head, and git branch shows that you are no longer on a branch\n>> head:\"\n>\n> Sure, but I prefer \"tip\"; reduces confusion between \"head\" and \"HEAD\"\n> in spoken descriptions (I teach internal classes on git occasionally,\n> once even on a conf call!)\n\n+1\n\nI was (am) was initially confused about head and HEAD and assumed that\nthey are both same.\n\n-- dm\n"},{"id":"98852","messageId":"gj96pl$885$4@ger.gmane.org","threadId":"16895","inReplyTo":"slrnglf3qh.c7j.sitaramc@sitaramc.homelinux.net","subject":"Re: user manual question","fromName":"Zorba","fromEmail":"cr@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-28T23:53:17Z","isPatch":false,"sender":{"key":"cr@altmore.co.uk","avatar":null},"body":"Hi Sitaram!\n\nThanks for clearing that one up.\n\nAlso, I did wonder about HEAD and head. One can move, the other doesn't! \n(well, acually it does - head moves \"forward\", as the tip of the branch \ngrows)\n\nyou gotta love it\n:-)\n\nThanks for your other post/reply too - I will be getting back to you on that \none\n\nConor\n\n\"Sitaram Chamarty\" <sitaramc@gmail.com> wrote in message \nnews:slrnglf3qh.c7j.sitaramc@sitaramc.homelinux.net...\n> On 2008-12-28, Zorba <cr@altmore.co.uk> wrote:\n>> Under \"Examining an old version without creating a new branch\" subsection \n>> in\n>> chapter1\n>>\n>> to aid my understanding, could the statement:\n>>\n>> \"The HEAD then refers to the SHA1 of the commit instead of to a branch, \n>> and\n>> git branch shows that you are no longer on a branch:\"\n>>\n>> be restated more explicitly as:\n>>\n>> \"The HEAD then refers to the SHA1 of the commit instead of to a branch \n>> head,\n>> and git branch shows that you are no longer on a branch head:\"\n>\n> Sure, but I prefer \"tip\"; reduces confusion between \"head\"\n> and \"HEAD\" in spoken descriptions (I teach internal classes\n> on git occasionally, once even on a conf call!)\n>\n> The git glossary makes no mention of \"tip\", so this is\n> probably \"unblessed\" :-)\n> \n"},{"id":"98854","messageId":"gj96uh$8j4$4@ger.gmane.org","threadId":"16895","inReplyTo":"c94f8e120812280836j4acab974s5139167ac6be54ee@mail.gmail.com","subject":"Re: user manual question","fromName":"Zorba","fromEmail":"cr@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-29T00:25:00Z","isPatch":false,"sender":{"key":"cr@altmore.co.uk","avatar":null},"body":"Hi Dilip,\n\nThanks for sharing that. It makes me feel not so stupid :-)\n\nregards\n\n>\n> +1\n>\n> I was (am) was initially confused about head and HEAD and assumed that\n> they are both same.\n>\n> -- dm \n"},{"id":"98855","messageId":"slrnglg90m.olt.sitaramc@sitaramc.homelinux.net","threadId":"16895","inReplyTo":"gj96pl$885$4@ger.gmane.org","subject":"Re: user manual question","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2008-12-29T01:12:54Z","receivedAt":"2008-12-29T01:12:54Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On 2008-12-29, Zorba <cr@altmore.co.uk> wrote:\n> Hi Sitaram!\n>\n> Thanks for clearing that one up.\n\nyou're welcome; we've all done a bit of struggling I guess!\n\n> Also, I did wonder about HEAD and head. One can move, the other doesn't! \n> (well, acually it does - head moves \"forward\", as the tip of the branch \n> grows)\n\nHere's an extract from my notes/internal talks on this:\n\n    === basic concepts\n      * a branch is \"an active line of development\"\n      * //master//: default branch in a project, by convention\n      * //head//: tip of a branch\n      * a repo can track many branches, but the working tree is associated with\n        only one branch at a time\n      * //HEAD//: tip of the branch associated with the working tree; this is\n        where commits go\n        ** except when it's \"detached\"\n\n> Thanks for your other post/reply too - I will be getting back to you on that \n> one\n\nGlad to be of help.  I don't consider myself a guru, and am\nconstantly waiting for one of the real gurus to strike me\ndown with a thunderbolt for saying something stupid :-)\n"},{"id":"98861","messageId":"c94f8e120812282233i3783cf65o5ad9663e079e7fd6@mail.gmail.com","threadId":"16895","inReplyTo":"slrnglg90m.olt.sitaramc@sitaramc.homelinux.net","subject":"Re: user manual question","fromName":"Dilip M","fromEmail":"dilipm79@gmail.com","sentAt":"2008-12-29T06:33:51Z","receivedAt":"2008-12-29T06:33:51Z","isPatch":false,"sender":{"key":"dilipm79@gmail.com","avatar":"https://gravatar.com/avatar/9417e308513ce9251de2802a026c72eb164e6c9b9d7143a3ee13f6ed0c4d1bd5?d=mp&s=160"},"body":"On Mon, Dec 29, 2008 at 6:42 AM, <sitaramc@gmail.com> wrote:\n> On 2008-12-29, Zorba <cr@altmore.co.uk> wrote:\n>> Hi Sitaram!\n>>\n>> Thanks for clearing that one up.\n>\n> you're welcome; we've all done a bit of struggling I guess!\n>\n>> Also, I did wonder about HEAD and head. One can move, the other\n>> doesn't!  (well, acually it does - head moves \"forward\", as the tip\n>> of the branch grows)\n>\n> Here's an extract from my notes/internal talks on this:\n>\n>    === basic concepts      * a branch is \"an active line of\n> development\"      * //master//: default branch in a project, by\n> convention      * //head//: tip of a branch      * a repo can track\n> many branches, but the working tree is associated with        only one\n> branch at a time      * //HEAD//: tip of the branch associated with\n> the working tree; this is        where commits go        ** except\n> when it's \"detached\"\n\nThat's a nice,compact and effective  note. Thanks for sharing :-)\nConsider pushing the full notes to GITHUB...would be _useful_ for all of\nus..(like me)...\n\n\n-- dm\n"},{"id":"98902","messageId":"20081229171825.GB6200@atjola.homenet","threadId":"16895","inReplyTo":"gjauel$94s$4@ger.gmane.org","subject":"Re: user manual question","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2008-12-29T17:18:25Z","receivedAt":"2008-12-29T17:18:25Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2008.12.29 16:38:30 -0000, Zorba wrote:\n> so a detached HEAD is just a HEAD that is not sitting on a tip ?\n> \n> i.e. if I do $ git reset --hard HEAD^\n> \n> ...pointing HEAD to the previous committ\n> \n> this is a detached HEAD\n\nNo. At least that won't turn an \"attached\" HEAD into a detached HEAD.\n\nAttached HEAD: HEAD is a symbolic ref to another ref.\nDetached HEAD: HEAD is a non-symbolic ref to a commit.\n\nSo you can have:\nHEAD -> refs/heads/master -> commitA  --> attached HEAD\n\nOr:\nHEAD -> commitA --> detached HEAD\n\nNote how the commit object is the same in both cases.\n\nWhat you \"git reset [--hard] HEAD^\" does, depends on the kind of HEAD\nyou have.\n\n\"git reset HEAD^\" will (conceptually, implementation might differ):\n\nResolve HEAD^ to find a commit.\n\nand\n\nResolve HEAD until it finds a non-symbolic ref, and update that ref to\nreference the commit it found.\n\nLooking at the cases from above:\n\nAttached case:\nHEAD -> refs/heads/master -> commitA\n\nResolve HEAD^:\nHEAD^ ==> refs/heads/master^ ==> commitA^ ==> commitA_parent\n\nFind non-symbolic ref:\nHEAD (symbolic) ==> refs/heads/master (non-symbolic)\n\nSo refs/heads/master gets updated to reference commitA_parent.\n\n\nNow the detached case:\nHEAD -> commitA\n\nResolve HEAD^:\nHEAD^ ==> commitA^ ==> commitA_parent\n\nFind non-symbolic ref:\nHEAD (non-symbolic)\n\nSo HEAD gets updated to reference commitA_parent.\n\n\nIn other words, HEAD is what tells git what you have checked out. And\nthat's either a branch head (attached HEAD, symbolic ref) or a commit\n(detached HEAD, non-symbolic ref).\n\nIn the symbolic ref case, operations like \"commit\" or \"reset\" work on\nthe branch you have checked out (found through the symbolic ref), in the\nnon-symbolic ref case (detached HEAD), those operations work on HEAD\nitself.\n\nBjörn\n"},{"id":"98903","messageId":"200812291820.58642.markus.heidelberg@web.de","threadId":"16895","inReplyTo":"gjauel$94s$4@ger.gmane.org","subject":"Re: user manual question","fromName":"Markus Heidelberg","fromEmail":"markus.heidelberg@web.de","sentAt":"2008-12-29T17:20:58Z","receivedAt":"2008-12-29T17:20:58Z","isPatch":false,"sender":{"key":"markus.heidelberg@web.de","avatar":"https://avatars.githubusercontent.com/u/6334512?v=4"},"body":"Zorba, 29.12.2008:\n> so a detached HEAD is just a HEAD that is not sitting on a tip ?\n\nYou can also get a detached HEAD with \"git checkout origin/master\",\nalthough your HEAD points to a tip. But it's a remote tip and since you\ncan't work on remote branches, you now are on a detached HEAD (no\nbranch).\n\n> i.e. if I do $ git reset --hard HEAD^\n> \n> ...pointing HEAD to the previous committ\n> \n> this is a detached HEAD\n\nNo, this isn't. \"git reset <commit>\" modifies your current head (local\nbranch), now HEAD still points to the tip, but the tip is one commit\nolder. A detached HEAD you can get with \"git checkout HEAD^\".\n"},{"id":"98904","messageId":"slrngli24v.8cd.sitaramc@sitaramc.homelinux.net","threadId":"16895","inReplyTo":"gjauel$94s$4@ger.gmane.org","subject":"Re: user manual question","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2008-12-29T17:27:59Z","receivedAt":"2008-12-29T17:27:59Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On 2008-12-29, Zorba <cr@altmore.co.uk> wrote:\n> so a detached HEAD is just a HEAD that is not sitting on a tip ?\n\nyes...\n\n> i.e. if I do $ git reset --hard HEAD^\n>\n> ...pointing HEAD to the previous committ\n>\n> this is a detached HEAD\n\n...but no.  This is because git reset moves the tip of the\nbranch also (in this case, backward by one commit from the\nprevious).  In effect, you're saying \"discard my latest\ncommit and roll back by one\".\n\n\"git checkout HEAD^\" would get you a detached head though.\nIn this case you're saying \"let the branch be where it is,\nbut let HEAD move up one level\".  So HEAD is now NOT at a\ntip, and it'a a detached head.\n\nIt's instructive to run \"gitk --all\" when you're doing these\nexperiments sometimes.\n\n> (I thought a detached HEAD was maybe a head somewhere on another branch not \n> \"reachable\", i.e. a sibling, not a ancestor...\n> or something like that)\n\nno no that's just another branch that's all.\n\nAll this is pretty confusing in the beginning, but if you\ndon't lose your head, it'll all become clear eventually.\n\n[What's that they say?  Oh yeah \"thank you ladies and\ngentlemen I'll be here all night\"!]\n"},{"id":"98897","messageId":"gjauel$94s$4@ger.gmane.org","threadId":"16895","inReplyTo":"slrnglg90m.olt.sitaramc@sitaramc.homelinux.net","subject":"Re: user manual question","fromName":"Zorba","fromEmail":"cr@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-29T17:29:13Z","isPatch":false,"sender":{"key":"cr@altmore.co.uk","avatar":null},"body":"so a detached HEAD is just a HEAD that is not sitting on a tip ?\n\ni.e. if I do $ git reset --hard HEAD^\n\n...pointing HEAD to the previous committ\n\nthis is a detached HEAD\n\n(I thought a detached HEAD was maybe a head somewhere on another branch not \n\"reachable\", i.e. a sibling, not a ancestor...\nor something like that)\n\n\nthanks guys\n\n\"Sitaram Chamarty\" <sitaramc@gmail.com> wrote in message \nnews:slrnglg90m.olt.sitaramc@sitaramc.homelinux.net...\n> On 2008-12-29, Zorba <cr@altmore.co.uk> wrote:\n>> Hi Sitaram!\n>>\n>> Thanks for clearing that one up.\n>\n> you're welcome; we've all done a bit of struggling I guess!\n>\n>> Also, I did wonder about HEAD and head. One can move, the other doesn't!\n>> (well, acually it does - head moves \"forward\", as the tip of the branch\n>> grows)\n>\n> Here's an extract from my notes/internal talks on this:\n>\n>    === basic concepts\n>      * a branch is \"an active line of development\"\n>      * //master//: default branch in a project, by convention\n>      * //head//: tip of a branch\n>      * a repo can track many branches, but the working tree is associated \n> with\n>        only one branch at a time\n>      * //HEAD//: tip of the branch associated with the working tree; this \n> is\n>        where commits go\n>        ** except when it's \"detached\"\n>\n>> Thanks for your other post/reply too - I will be getting back to you on \n>> that\n>> one\n>\n> Glad to be of help.  I don't consider myself a guru, and am\n> constantly waiting for one of the real gurus to strike me\n> down with a thunderbolt for saying something stupid :-)\n> \n"},{"id":"98909","messageId":"alpine.LNX.1.00.0812291358460.19665@iabervon.org","threadId":"16895","inReplyTo":"gjauel$94s$4@ger.gmane.org","subject":"Re: user manual question","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-12-29T19:30:21Z","receivedAt":"2008-12-29T19:30:21Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Mon, 29 Dec 2008, Zorba wrote:\n\n> so a detached HEAD is just a HEAD that is not sitting on a tip ?\n\nIf you used CVS (extensively) back in the day, a detached HEAD is like \nwhat you get if you do something like \"cvs checkout -D yesterday\" (CVS \ncalled it \"sticky tags\"); you have a working directory that contains some \nrevision that isn't your latest revision. If you make changes, they can't \ngo into the history in the normal fashion, but you can build the project \nand figure out how it worked back then.\n\nWith git, of course, you can do things you couldn't do from that state \nwith CVS. Because git supports forking history, you can make commits and \ncreate a new branch to be on. Because git can handle having visibility \ninto other people's branches, you can get a detached HEAD by checking out \nsomebody else's branch (something like origin/next, for example).\n\nThe normal \"attached HEAD\" state is that there's some branch that you \nupdate when you make a commit; the \"detached HEAD\" state means that, when \nyou make a commit, no branch is affected.\n\n> i.e. if I do $ git reset --hard HEAD^\n> \n> ...pointing HEAD to the previous committ\n> \n> this is a detached HEAD\n\nNope, it's \"git checkout (something that isn't one of your branches)\", \njust like CVS.\n\nGit is like knitting. Commits are loops of yarn that hold other loops \n(their parents) in place; branches are knitting needles that keep new \nloops from falling out before other loops are holding them, and which hold \ndifferent loops at different times as you work; HEAD is the tip of a \nneedle that you use to make new loops. You usually use the tip of one of \nyour regular needles to make new loops, and then the body of the needle \nholds the loop, but you could also use your fingers or something that will \njust make the loop temporarily; that's a detached HEAD, because it doesn't \nhave the body of a needle behind it to hold loops when you use it for \nsomething else.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"}]}