{"thread":{"id":"7717","subject":"git branch --switch?","startedAt":"2007-04-17T13:36:24Z","lastAt":"2007-04-17T17:27:59Z","messageCount":18,"participants":["Rene Herman","Alex Riesen","Brian Gernhardt","Lars Hjemli","Linus Torvalds","Randal L. Schwartz"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"39644","messageId":"4624CD58.90103@gmail.com","threadId":"7717","inReplyTo":null,"subject":"git branch --switch?","fromName":"Rene Herman","fromEmail":"rene.herman@gmail.com","sentAt":"2007-04-17T13:36:24Z","receivedAt":"2007-04-17T13:36:24Z","isPatch":false,"sender":{"key":"rene.herman@gmail.com","avatar":null},"body":"Good day.\n\nIs it possible to switch the current branch without checking it out? Not \nreally essential, but I'm happily flaundering around with git and still \nstart from scratch fairly regularly; to speed this up I've found the -n \nswitch to git clone useful and would like something similar when \nreconstructing my \"branch hierarchies\".\n\nUpto now I only know about \"git checkout\" (with or without -b) to switch the \ncurrent branch. As said it's not really essential, but I was expecting there \nwould be something like a \"branch --switch\". Did I overlook it?\n\nRene.\n"},{"id":"39647","messageId":"81b0412b0704170721i2b64999aqbd0d7489074454d6@mail.gmail.com","threadId":"7717","inReplyTo":"4624CD58.90103@gmail.com","subject":"Re: git branch --switch?","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-04-17T14:21:29Z","receivedAt":"2007-04-17T14:21:29Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 4/17/07, Rene Herman <rene.herman@gmail.com> wrote:\n> Is it possible to switch the current branch without checking it out? Not\n> really essential, but I'm happily flaundering around with git and still\n> start from scratch fairly regularly; to speed this up I've found the -n\n> switch to git clone useful and would like something similar when\n> reconstructing my \"branch hierarchies\".\n>\n> Upto now I only know about \"git checkout\" (with or without -b) to switch the\n> current branch. As said it's not really essential, but I was expecting there\n> would be something like a \"branch --switch\". Did I overlook it?\n\nKind of. It can be done with git-read-tree. I.e.:\n\n  $ git-read-tree --index-output=.git/tmp-index <branch-name> && \\\n     mv tmp-index .git/index && \\\n     git update-ref HEAD <branch-name>\n"},{"id":"39649","messageId":"4624D9E0.7080303@gmail.com","threadId":"7717","inReplyTo":"81b0412b0704170721i2b64999aqbd0d7489074454d6@mail.gmail.com","subject":"Re: git branch --switch?","fromName":"Rene Herman","fromEmail":"rene.herman@gmail.com","sentAt":"2007-04-17T14:29:52Z","receivedAt":"2007-04-17T14:29:52Z","isPatch":false,"sender":{"key":"rene.herman@gmail.com","avatar":null},"body":"On 04/17/2007 04:21 PM, Alex Riesen wrote:\n\n> On 4/17/07, Rene Herman <rene.herman@gmail.com> wrote:\n\n>> Is it possible to switch the current branch without checking it out?\n\n[ ... ]\n\n> Kind of. It can be done with git-read-tree. I.e.:\n> \n>  $ git-read-tree --index-output=.git/tmp-index <branch-name> && \\\n>     mv tmp-index .git/index && \\\n>     git update-ref HEAD <branch-name>\n\nEew. Thank you. Maybe...\n\nRene.\n"},{"id":"39648","messageId":"C940520E-732A-4F6E-A7F2-0215FD534455@silverinsanity.com","threadId":"7717","inReplyTo":"4624CD58.90103@gmail.com","subject":"Re: git branch --switch?","fromName":"Brian Gernhardt","fromEmail":"benji@silverinsanity.com","sentAt":"2007-04-17T14:31:20Z","receivedAt":"2007-04-17T14:31:20Z","isPatch":false,"sender":{"key":"benji@silverinsanity.com","avatar":"https://gravatar.com/avatar/e06c101dbc25c68114d859b4a9ec7cf8a2c52fd2b0270ef0eac0e2e63ff22311?d=mp&s=160"},"body":"\nOn Apr 17, 2007, at 9:36 AM, Rene Herman wrote:\n\n> Is it possible to switch the current branch without checking it  \n> out? Not really essential, but I'm happily flaundering around with  \n> git and still start from scratch fairly regularly; to speed this up  \n> I've found the -n switch to git clone useful and would like  \n> something similar when reconstructing my \"branch hierarchies\".\n>\n> Upto now I only know about \"git checkout\" (with or without -b) to  \n> switch the current branch. As said it's not really essential, but I  \n> was expecting there would be something like a \"branch --switch\".  \n> Did I overlook it?\n\nPerusing git-checkout points me to git-symbolic-ref to update the  \nHEAD ref to a new branch:\n\ngit symbolic-ref HEAD refs/heads/<branch>\n\nHowever, I'm somewhat confused as to why you'd want HEAD and the  \nworking directory to get out of sync.  It would cause any further  \ncommits to have broken history information.  If you want to make the  \ncontent of one branch ($branchA) the same as the other ($branchB),  \nyou should do something like:\n\ngit checkout -b temp $branchB    # Get content from branchB\ngit merge -s ours $branchA       # Merge history (not content) from  \nbranchA\ngit branch -M $branchA           # Make this new merge branchA\n\nThis would be significantly simpler if there was a \"theirs\" merge  \nstrategy \"git checkout $branchA; git merge -s theirs $branchB\", but  \nthere isn't.  Should be simple to write if you really need it though.\n\n~~ Brian\n"},{"id":"39653","messageId":"F47212AE-B31D-4025-9859-6794E7405DF2@silverinsanity.com","threadId":"7717","inReplyTo":"81b0412b0704170721i2b64999aqbd0d7489074454d6@mail.gmail.com","subject":"Re: git branch --switch?","fromName":"Brian Gernhardt","fromEmail":"benji@silverinsanity.com","sentAt":"2007-04-17T14:46:38Z","receivedAt":"2007-04-17T14:46:38Z","isPatch":false,"sender":{"key":"benji@silverinsanity.com","avatar":"https://gravatar.com/avatar/e06c101dbc25c68114d859b4a9ec7cf8a2c52fd2b0270ef0eac0e2e63ff22311?d=mp&s=160"},"body":"\nOn Apr 17, 2007, at 10:21 AM, Alex Riesen wrote:\n\n> Kind of. It can be done with git-read-tree. I.e.:\n>\n>  $ git-read-tree --index-output=.git/tmp-index <branch-name> && \\\n>     mv tmp-index .git/index && \\\n>     git update-ref HEAD <branch-name>\n\nThis does not appear to do what you think it will.  git update-ref  \nwill write the SHA1 of <branch-name> into the current HEAD, not  \nswitch HEAD to a new branch.\n\nHowever, the first two lines will correctly update the index to the  \nnew head which is probably a good idea.\n\n~~ Brian\n"},{"id":"39654","messageId":"81b0412b0704170811h510ce0afn1b2277b752bdf422@mail.gmail.com","threadId":"7717","inReplyTo":"F47212AE-B31D-4025-9859-6794E7405DF2@silverinsanity.com","subject":"Re: git branch --switch?","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-04-17T15:11:33Z","receivedAt":"2007-04-17T15:11:33Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 4/17/07, Brian Gernhardt <benji@silverinsanity.com> wrote:\n>\n> On Apr 17, 2007, at 10:21 AM, Alex Riesen wrote:\n>\n> > Kind of. It can be done with git-read-tree. I.e.:\n> >\n> >  $ git-read-tree --index-output=.git/tmp-index <branch-name> && \\\n> >     mv tmp-index .git/index && \\\n> >     git update-ref HEAD <branch-name>\n>\n> This does not appear to do what you think it will.  git update-ref\n> will write the SHA1 of <branch-name> into the current HEAD, not\n> switch HEAD to a new branch.\n>\n\nach, right. Dangerous: it can change the ref HEAD points to. Very sorry!\nBetter just:\n\n $ rm .git/HEAD && git symbolic-ref HEAD \"refs/heads/<branch-name>\"\n\nIn the end, you just have git-checkout minus git-checkout-index. Maybe\na \"git-checkout -n\" can be useful. Even though I can't imagine what for.\n"},{"id":"39660","messageId":"4624EAAA.6040000@gmail.com","threadId":"7717","inReplyTo":"C940520E-732A-4F6E-A7F2-0215FD534455@silverinsanity.com","subject":"Re: git branch --switch?","fromName":"Rene Herman","fromEmail":"rene.herman@gmail.com","sentAt":"2007-04-17T15:41:30Z","receivedAt":"2007-04-17T15:41:30Z","isPatch":false,"sender":{"key":"rene.herman@gmail.com","avatar":null},"body":"On 04/17/2007 04:31 PM, Brian Gernhardt wrote:\n\n>> Is it possible to switch the current branch without checking it out? \n>> Not really essential, but I'm happily flaundering around with git and \n>> still start from scratch fairly regularly; to speed this up I've found \n>> the -n switch to git clone useful and would like something similar \n>> when reconstructing my \"branch hierarchies\".\n>>\n>> Upto now I only know about \"git checkout\" (with or without -b) to \n>> switch the current branch. As said it's not really essential, but I \n>> was expecting there would be something like a \"branch --switch\". Did I \n>> overlook it?\n> \n> Perusing git-checkout points me to git-symbolic-ref to update the HEAD \n> ref to a new branch:\n> \n> git symbolic-ref HEAD refs/heads/<branch>\n> \n> However, I'm somewhat confused as to why you'd want HEAD and the working \n> directory to get out of sync.\n\nThank you for the answer. Well, as said, it's not essential, but I was just \nnow rebuilding a repo and have a few branches that I all want to be based on \nthe same revision. Say, branch a, b and c, based on v2.6.20.\n\ngit clone -l -s -n <a local linux repo> local\ngit checkout -b v20 v2.6.20\ngit branch a\ngit branch b\ngit branch c\n\nStep 1, 3, 4 and 5 of this are nearly instantaneous but 2 isn't -- this repo \nsits on a P1 with 64M of memory and a disk doing 8 M/s which is probably the \nonly reason I thought asking about it was a good idea in the first place...\n\nYou'd be quite right in saying that there isn't much point; if I want to now \nstart populating branch a, I have to \"git checkout a\" anyway, and that \naction _will_ now be instantaneous. If I'd replaced 2 with:\n\ngit branch --create-and-set-as-current v20 v2.6.20\n\nthen I will not have won any time until that 6th \"git checkout a\" step.\n\nThe checkout of v20 was superfluous in this though, and I just expected I \nshould be able to skip that. It fitted my mental model...\n\nRene.\n"},{"id":"39662","messageId":"4624EB76.2030700@gmail.com","threadId":"7717","inReplyTo":"81b0412b0704170811h510ce0afn1b2277b752bdf422@mail.gmail.com","subject":"Re: git branch --switch?","fromName":"Rene Herman","fromEmail":"rene.herman@gmail.com","sentAt":"2007-04-17T15:44:54Z","receivedAt":"2007-04-17T15:44:54Z","isPatch":false,"sender":{"key":"rene.herman@gmail.com","avatar":null},"body":"On 04/17/2007 05:11 PM, Alex Riesen wrote:\n\n> ach, right. Dangerous: it can change the ref HEAD points to. Very sorry!\n> Better just:\n> \n> $ rm .git/HEAD && git symbolic-ref HEAD \"refs/heads/<branch-name>\"\n\nThanks.\n\n> In the end, you just have git-checkout minus git-checkout-index. Maybe\n> a \"git-checkout -n\" can be useful. Even though I can't imagine what for.\n\nThought about that as well, to keep with clone, but giving \"checkout\" an \noption to not checkout seems somewhat odd.\n\n\"git branch -s\" for \"not only create but Set current to it as well\" maybe?\n\nRene.\n"},{"id":"39663","messageId":"4624EC18.4000500@gmail.com","threadId":"7717","inReplyTo":"4624EAAA.6040000@gmail.com","subject":"Re: git branch --switch?","fromName":"Rene Herman","fromEmail":"rene.herman@gmail.com","sentAt":"2007-04-17T15:47:36Z","receivedAt":"2007-04-17T15:47:36Z","isPatch":false,"sender":{"key":"rene.herman@gmail.com","avatar":null},"body":"On 04/17/2007 05:41 PM, Rene Herman wrote:\n\n> On 04/17/2007 04:31 PM, Brian Gernhardt wrote:\n\n>> However, I'm somewhat confused as to why you'd want HEAD and the \n>> working directory to get out of sync.\n> \n> Thank you for the answer. Well, as said, it's not essential, but I was \n> just now rebuilding a repo and have a few branches that I all want to be \n> based on the same revision. Say, branch a, b and c, based on v2.6.20.\n> \n> git clone -l -s -n <a local linux repo> local\n> git checkout -b v20 v2.6.20\n> git branch a\n> git branch b\n> git branch c\n> \n> Step 1, 3, 4 and 5 of this are nearly instantaneous but 2 isn't -- this \n> repo sits on a P1 with 64M of memory and a disk doing 8 M/s which is \n> probably the only reason I thought asking about it was a good idea in \n> the first place...\n> \n> You'd be quite right in saying that there isn't much point; if I want to \n> now start populating branch a, I have to \"git checkout a\" anyway, and \n> that action _will_ now be instantaneous. If I'd replaced 2 with:\n> \n> git branch --create-and-set-as-current v20 v2.6.20\n> \n> then I will not have won any time until that 6th \"git checkout a\" step.\n\ns/until/after/\n\n> The checkout of v20 was superfluous in this though, and I just expected \n> I should be able to skip that. It fitted my mental model...\n\nRene.\n"},{"id":"39665","messageId":"8c5c35580704170855ke426d86vac6e9b3b67fea5ea@mail.gmail.com","threadId":"7717","inReplyTo":"4624EAAA.6040000@gmail.com","subject":"Re: git branch --switch?","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2007-04-17T15:55:32Z","receivedAt":"2007-04-17T15:55:32Z","isPatch":false,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"On 4/17/07, Rene Herman <rene.herman@gmail.com> wrote:\n> git clone -l -s -n <a local linux repo> local\n> git checkout -b v20 v2.6.20\n> git branch a\n> git branch b\n> git branch c\n>\n> Step 1, 3, 4 and 5 of this are nearly instantaneous but 2 isn't\n\nI might have misunderstood your goal, but have you tried\n\n git clone -l -s -n <a local linux repo> local\n git branch a v2.6.20\n git branch b a\n git branch c a\n\nNow a, b and c all point at v2.6.20, while HEAD points as master.\n\n--\nlarsh\n"},{"id":"39669","messageId":"4624F18F.6070906@gmail.com","threadId":"7717","inReplyTo":"8c5c35580704170855ke426d86vac6e9b3b67fea5ea@mail.gmail.com","subject":"Re: git branch --switch?","fromName":"Rene Herman","fromEmail":"rene.herman@gmail.com","sentAt":"2007-04-17T16:10:55Z","receivedAt":"2007-04-17T16:10:55Z","isPatch":false,"sender":{"key":"rene.herman@gmail.com","avatar":null},"body":"On 04/17/2007 05:55 PM, Lars Hjemli wrote:\n\n> On 4/17/07, Rene Herman <rene.herman@gmail.com> wrote:\n\n>> git clone -l -s -n <a local linux repo> local\n>> git checkout -b v20 v2.6.20\n>> git branch a\n>> git branch b\n>> git branch c\n>>\n>> Step 1, 3, 4 and 5 of this are nearly instantaneous but 2 isn't\n> \n> I might have misunderstood your goal, but have you tried\n> \n> git clone -l -s -n <a local linux repo> local\n> git branch a v2.6.20\n> git branch b a\n> git branch c a\n> \n> Now a, b and c all point at v2.6.20, while HEAD points as master.\n\nWell, yes, they do, and I could also do\n\ngit branch b v2.6.20\ngit branch c v2.6.20\n\ndirectly then (right?) but I do want that \"v20\" branch in the middle. The \ncloned repo is a linus repo, and that v20 is where I'll be pulling 2.6.20.y \nupdates into; a merge branch will then merge v20, a, b and c into what I \nwill be compiling.\n\nAs said, given that I need to checkout things anyway to do something with \nthem it'a all not essential but as a newbie, I just thought that a \"branch \n--and-set-as-current new_branch\" made sense. My sense of sense may be crap; \nI've largely avoided dealing with souce code management, regarding CVS and \nSVN as unfortunate facts of life to work around and forget, mostly.\n\nRene.\n"},{"id":"39671","messageId":"4624F4BB.7010308@gmail.com","threadId":"7717","inReplyTo":"4624EAAA.6040000@gmail.com","subject":"Re: git branch --switch?","fromName":"Rene Herman","fromEmail":"rene.herman@gmail.com","sentAt":"2007-04-17T16:24:27Z","receivedAt":"2007-04-17T16:24:27Z","isPatch":false,"sender":{"key":"rene.herman@gmail.com","avatar":null},"body":"On 04/17/2007 05:41 PM, Rene Herman wrote:\n\n> You'd be quite right in saying that there isn't much point; if I want to \n> now start populating branch a, I have to \"git checkout a\" anyway, and \n> that action _will_ now be instantaneous.\n\nActually, I take that back, it's not instantaneous at all. 1995 systems are \nmuch better at showing long delays than those fancy modern computers are!\n\nRene.\n"},{"id":"39672","messageId":"Pine.LNX.4.64.0704170938510.5473@woody.linux-foundation.org","threadId":"7717","inReplyTo":"4624F4BB.7010308@gmail.com","subject":"Re: git branch --switch?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-04-17T16:44:43Z","receivedAt":"2007-04-17T16:44:43Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 17 Apr 2007, Rene Herman wrote:\n\n> On 04/17/2007 05:41 PM, Rene Herman wrote:\n> \n> > You'd be quite right in saying that there isn't much point; if I want to now\n> > start populating branch a, I have to \"git checkout a\" anyway, and that\n> > action _will_ now be instantaneous.\n> \n> Actually, I take that back, it's not instantaneous at all. 1995 systems are\n> much better at showing long delays than those fancy modern computers are!\n\nYou'll always have at least _one_ slow checkout. If you checkout at all.\n\nThe kernel archive is 8 million lines - 240MB or so checked out. Writing \nout that 240 MB to disk is not going to be instantaneous even on a modern \nmachine, although having so much memory that you can ignore the writeout \nand let it happen in the background will certainly help.\n\nIf you don't need to build the tree, you can avoid the checkout entirely, \nof course. Most git operations don't actually need a checked-out tree at \nall, and you could even have done a bare clone and just inspected it with \ngit tools if that's what is wanted.\n\nSo you could have avoided the checkout completely, and done\n\n\tgit clone -l -s -n <a local linux repo> local\n\tgit branch v20 v2.6.20\n\tgit branch a v20\n\tgit branch b v20\n\tgit branch c v20\n\nand now you'd have four branches that all point to the v20 thing, and none \nof them are actually checked out. And all of that would have been \ninstantaneous, even on an old machine (apart fromt he clone itself, of \ncourse ;)\n\nBut the moment you decide to write 240MB to disk, you'll be slow.\n\n\t\t\tLinus\n"},{"id":"39673","messageId":"86y7kr0wst.fsf@blue.stonehenge.com","threadId":"7717","inReplyTo":"4624F18F.6070906@gmail.com","subject":"Re: git branch --switch?","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2007-04-17T16:50:58Z","receivedAt":"2007-04-17T16:50:58Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":">>>>> \"Rene\" == Rene Herman <rene.herman@gmail.com> writes:\n\nRene> Well, yes, they do, and I could also do\n\nRene> git branch b v2.6.20\nRene> git branch c v2.6.20\n\nRene> directly then (right?) but I do want that \"v20\" branch in the middle.\n\nWhat does \"in the middle\" mean here?\n\nIf I set:\n\n   b = a;\n   c = a;\n\nThat's the same as if I said:\n\n   b = a;\n   c = b;\n\nWhy do you think those would be different?  There's nothing recorded\nwhen you say \"git branch X Y\" except to make a new X that's a copy\nof the SHA1 of the old Y.\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nPerl/Unix/security consulting, Technical writing, Comedy, etc. etc.\nSee PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!\n"},{"id":"39675","messageId":"4624FBEB.5080805@gmail.com","threadId":"7717","inReplyTo":"Pine.LNX.4.64.0704170938510.5473@woody.linux-foundation.org","subject":"Re: git branch --switch?","fromName":"Rene Herman","fromEmail":"rene.herman@gmail.com","sentAt":"2007-04-17T16:55:07Z","receivedAt":"2007-04-17T16:55:07Z","isPatch":false,"sender":{"key":"rene.herman@gmail.com","avatar":null},"body":"On 04/17/2007 06:44 PM, Linus Torvalds wrote:\n\n> So you could have avoided the checkout completely, and done\n> \n> \tgit clone -l -s -n <a local linux repo> local\n> \tgit branch v20 v2.6.20\n> \tgit branch a v20\n> \tgit branch b v20\n> \tgit branch c v20\n> \n> and now you'd have four branches that all point to the v20 thing, and none \n> of them are actually checked out. And all of that would have been \n> instantaneous, even on an old machine (apart fromt he clone itself, of \n> course ;)\n\nYes, this is exactly what I wanted, thank you. I'm only learning about \"git \nbranch\" (as opposed to git checkout -b) now and it didn't in fact occur to \nme that I could specify that <start-point> although I should've noticed in \nthe manpage and certainly in Lars' reply from a few minutes back -- managed \nto go into that and still not have it click.\n\nNothing left for me to desire...\n\nRene.\n"},{"id":"39676","messageId":"8c5c35580704171000g74d8944w7c7b3d07228cac2@mail.gmail.com","threadId":"7717","inReplyTo":"4624F18F.6070906@gmail.com","subject":"Re: git branch --switch?","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2007-04-17T17:00:18Z","receivedAt":"2007-04-17T17:00:18Z","isPatch":false,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"On 4/17/07, Rene Herman <rene.herman@gmail.com> wrote:\n> On 04/17/2007 05:55 PM, Lars Hjemli wrote:\n> > I might have misunderstood your goal, but have you tried\n> >\n> > git clone -l -s -n <a local linux repo> local\n> > git branch a v2.6.20\n> > git branch b a\n> > git branch c a\n> >\n> > Now a, b and c all point at v2.6.20, while HEAD points as master.\n>\n> Well, yes, they do, and I could also do\n>\n> git branch b v2.6.20\n> git branch c v2.6.20\n>\n> directly then (right?)\n\nYes\n\n\n> but I do want that \"v20\" branch in the middle. The\n> cloned repo is a linus repo, and that v20 is where I'll be pulling 2.6.20.y\n> updates into; a merge branch will then merge v20, a, b and c into what I\n> will be compiling.\n\nOk. Then maybe you want to try something like this:\n\n$ git clone -l -s -n ../linux-2.6 rene\n$ cd rene\n$ git remote add v20\ngit://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.20.y\n$ git fetch v20\n\nThis gives you a tracking branch for 2.6.20.y, named as \"v20/master\".\nThat branch can then be used as a starting point for your a, b and c\nbranches, like:\n\n$ git checkout -b a v20/master    # this _will_ take some time...\n\nAfter applying some changes on branch a, you can then merge the latest\nchanges on the v20-branch like this\n\n$ git fetch v20\n$ git merge v20/master\n\nIf you want the merge to occur on a separate branch, do this first:\n\n$ git checkout -b tmp a\n\n\n--\nlarsh\n"},{"id":"39678","messageId":"4624FDF2.6020003@gmail.com","threadId":"7717","inReplyTo":"86y7kr0wst.fsf@blue.stonehenge.com","subject":"Re: git branch --switch?","fromName":"Rene Herman","fromEmail":"rene.herman@gmail.com","sentAt":"2007-04-17T17:03:46Z","receivedAt":"2007-04-17T17:03:46Z","isPatch":false,"sender":{"key":"rene.herman@gmail.com","avatar":null},"body":"On 04/17/2007 06:50 PM, Randal L. Schwartz wrote:\n\n> Rene> directly then (right?) but I do want that \"v20\" branch in the middle.\n> \n> What does \"in the middle\" mean here?\n\nIn the middle of my mental model if nothing else :-) But never mind, I was \nconfused; ignored Lars' info about branch starting points (and even myself \nstating it before) but given them, I have all I want.\n\nRene.\n"},{"id":"39684","messageId":"4625039F.7000804@gmail.com","threadId":"7717","inReplyTo":"8c5c35580704171000g74d8944w7c7b3d07228cac2@mail.gmail.com","subject":"Re: git branch --switch?","fromName":"Rene Herman","fromEmail":"rene.herman@gmail.com","sentAt":"2007-04-17T17:27:59Z","receivedAt":"2007-04-17T17:27:59Z","isPatch":false,"sender":{"key":"rene.herman@gmail.com","avatar":null},"body":"On 04/17/2007 07:00 PM, Lars Hjemli wrote:\n\n> Ok. Then maybe you want to try something like this:\n> \n> $ git clone -l -s -n ../linux-2.6 rene\n> $ cd rene\n> $ git remote add v20\n> git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.20.y\n> $ git fetch v20\n> \n> This gives you a tracking branch for 2.6.20.y, named as \"v20/master\".\n> That branch can then be used as a starting point for your a, b and c\n> branches, like:\n> \n> $ git checkout -b a v20/master    # this _will_ take some time...\n> \n> After applying some changes on branch a, you can then merge the latest\n> changes on the v20-branch like this\n> \n> $ git fetch v20\n> $ git merge v20/master\n> \n> If you want the merge to occur on a separate branch, do this first:\n> \n> $ git checkout -b tmp a\n\nThanks much! This is very useful.\n\nRene.\n"}]}