{"thread":{"id":"24136","subject":"moving a remote branch?","startedAt":"2010-06-17T04:35:00Z","lastAt":"2010-06-17T15:05:33Z","messageCount":8,"participants":["Thomas Anderson","Nazri Ramliy","Peter Kjellerstedt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"143848","messageId":"AANLkTikA5jGl1LiU2sNTN1NP_syTfPAeLF7sS6dBozyN@mail.gmail.com","threadId":"24136","inReplyTo":null,"subject":"moving a remote branch?","fromName":"Thomas Anderson","fromEmail":"zelnaga@gmail.com","sentAt":"2010-06-17T04:35:00Z","receivedAt":"2010-06-17T04:35:00Z","isPatch":false,"sender":{"key":"zelnaga@gmail.com","avatar":null},"body":"git branch -m origin/zelnaga/featurea origin/zelnaga/featureb doesn't\nseem to be working for me.  Instead, I get this error:l\n\nerror: refname refs/heads/origin/zelnaga/featurea\nfatal: Branch rename failed\n\nAny ideas?\n"},{"id":"143850","messageId":"AANLkTimTSU7Db7cMlC0ZxQ47IoBUr4Ee4G-GfgDoYLmK@mail.gmail.com","threadId":"24136","inReplyTo":"AANLkTikA5jGl1LiU2sNTN1NP_syTfPAeLF7sS6dBozyN@mail.gmail.com","subject":"Re: moving a remote branch?","fromName":"Nazri Ramliy","fromEmail":"ayiehere@gmail.com","sentAt":"2010-06-17T06:19:59Z","receivedAt":"2010-06-17T06:19:59Z","isPatch":false,"sender":{"key":"ayiehere@gmail.com","avatar":"https://avatars.githubusercontent.com/u/164756?v=4"},"body":"On Thu, Jun 17, 2010 at 12:35 PM, Thomas Anderson <zelnaga@gmail.com> wrote:\n> git branch -m origin/zelnaga/featurea origin/zelnaga/featureb doesn't\n> seem to be working for me.  Instead, I get this error:l\n>\n> error: refname refs/heads/origin/zelnaga/featurea\n> fatal: Branch rename failed\n>\n> Any ideas?\n\nThe error  message could be improved here.\n\nThe reason you get the error is because you were asking git\nto rename a \"remote\" branch, which it refuses to do because,\nwell, it's a remote branch, and for all practical purposes git\nwon't allow you to modify any \"remote\" stuff as they are all\nread-only from our point of view.\n\nIf you run \"git remote -v\" you'll most likely see that \"origin\"\nis listed in the output which means that your \"origin/zelnaga/featurea\"\nis a remote branch because its name begin with \"origin/\".\n\nHope this helps.\n\nnazri.\n"},{"id":"143851","messageId":"A612847CFE53224C91B23E3A5B48BAC74483CEEA82@xmail3.se.axis.com","threadId":"24136","inReplyTo":"AANLkTimTSU7Db7cMlC0ZxQ47IoBUr4Ee4G-GfgDoYLmK@mail.gmail.com","subject":"RE: moving a remote branch?","fromName":"Peter Kjellerstedt","fromEmail":"peter.kjellerstedt@axis.com","sentAt":"2010-06-17T08:28:46Z","receivedAt":"2010-06-17T08:28:46Z","isPatch":false,"sender":{"key":"peter.kjellerstedt@axis.com","avatar":"https://gravatar.com/avatar/6d5a0182283c8eccd7b134a54dbfd5f30038f3ad4d38b96f424884b614a61ca2?d=mp&s=160"},"body":"> -----Original Message-----\n> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On\n> Behalf Of Nazri Ramliy\n> Sent: den 17 juni 2010 08:20\n> To: Thomas Anderson\n> Cc: git@vger.kernel.org\n> Subject: Re: moving a remote branch?\n> \n> On Thu, Jun 17, 2010 at 12:35 PM, Thomas Anderson <zelnaga@gmail.com>\n> wrote:\n> > git branch -m origin/zelnaga/featurea origin/zelnaga/featureb doesn't\n> > seem to be working for me.  Instead, I get this error:l\n> >\n> > error: refname refs/heads/origin/zelnaga/featurea\n> > fatal: Branch rename failed\n> >\n> > Any ideas?\n> \n> The error  message could be improved here.\n> \n> The reason you get the error is because you were asking git\n> to rename a \"remote\" branch, which it refuses to do because,\n> well, it's a remote branch, and for all practical purposes git\n> won't allow you to modify any \"remote\" stuff as they are all\n> read-only from our point of view.\n> \n> If you run \"git remote -v\" you'll most likely see that \"origin\"\n> is listed in the output which means that your \"origin/zelnaga/featurea\"\n> is a remote branch because its name begin with \"origin/\".\n> \n> Hope this helps.\n> \n> nazri.\n\nRenaming a remote branch is a two step operation. First you push the \nold branch into its new name, and then you remove the old branch. It \ncan be done with these commands:\n\n\tgit push origin origin/featurea:refs/heads/featureb\n\tgit push origin :featurea\n\n//Peter\n"},{"id":"143861","messageId":"AANLkTikeLpvGA-RFBdMGblOnhNKJ6dUrpUZQlENMP51A@mail.gmail.com","threadId":"24136","inReplyTo":"A612847CFE53224C91B23E3A5B48BAC74483CEEA82@xmail3.se.axis.com","subject":"Re: moving a remote branch?","fromName":"Nazri Ramliy","fromEmail":"ayiehere@gmail.com","sentAt":"2010-06-17T12:13:08Z","receivedAt":"2010-06-17T12:13:08Z","isPatch":false,"sender":{"key":"ayiehere@gmail.com","avatar":"https://avatars.githubusercontent.com/u/164756?v=4"},"body":"On Thu, Jun 17, 2010 at 4:28 PM, Peter Kjellerstedt > Renaming a\nremote branch is a two step operation. First you push the\n> old branch into its new name, and then you remove the old branch. It\n> can be done with these commands:\n>\n>        git push origin origin/featurea:refs/heads/featureb\n>        git push origin :featurea\n\nI'd like to add (more confusion!:) with this clarification:\n\nThe two push operation above rename the branch on the remote side.\nIt does not affect any of your local branches.\n\nIf you do \"git branch -a\" then you'd still see the\n\"origin/zelnaga/featurea\" branch.\n\nDoing a \"git fetch origin\" will get the newly renamed branch from the\nremote repo and create a local version of it on your local repo.\n\nAt this point you can do \"git branch -D origin/featurea\".\n\nnazri\n"},{"id":"143863","messageId":"A612847CFE53224C91B23E3A5B48BAC74483CEEB16@xmail3.se.axis.com","threadId":"24136","inReplyTo":"AANLkTikeLpvGA-RFBdMGblOnhNKJ6dUrpUZQlENMP51A@mail.gmail.com","subject":"RE: moving a remote branch?","fromName":"Peter Kjellerstedt","fromEmail":"peter.kjellerstedt@axis.com","sentAt":"2010-06-17T13:02:14Z","receivedAt":"2010-06-17T13:02:14Z","isPatch":false,"sender":{"key":"peter.kjellerstedt@axis.com","avatar":"https://gravatar.com/avatar/6d5a0182283c8eccd7b134a54dbfd5f30038f3ad4d38b96f424884b614a61ca2?d=mp&s=160"},"body":"> -----Original Message-----\n> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On\n> Behalf Of Nazri Ramliy\n> Sent: den 17 juni 2010 14:13\n> To: Peter Kjellerstedt\n> Cc: Thomas Anderson; git@vger.kernel.org\n> Subject: Re: moving a remote branch?\n> \n> On Thu, Jun 17, 2010 at 4:28 PM, Peter Kjellerstedt \n> > Renaming a remote branch is a two step operation. First you push the\n> > old branch into its new name, and then you remove the old branch. It\n> > can be done with these commands:\n> >\n> >        git push origin origin/featurea:refs/heads/featureb\n> >        git push origin :featurea\n> \n> I'd like to add (more confusion!:) with this clarification:\n> \n> The two push operation above rename the branch on the remote side.\n> It does not affect any of your local branches.\n\nNo, it does not affect any local branches, but it _does_ effect \nthe representation of the remote branches in the local repository.\n\n> If you do \"git branch -a\" then you'd still see the\n> \"origin/zelnaga/featurea\" branch.\n\nNo, you will not (at least not with git 1.7.1 that I use). \n\nNeither do you need to do the two steps below as the two pushes \nabove are enough to also keep the status of the remote branches \nin sync in the local repository..\n\n> Doing a \"git fetch origin\" will get the newly renamed branch from the\n> remote repo and create a local version of it on your local repo.\n> \n> At this point you can do \"git branch -D origin/featurea\".\n> \n> nazri\n\n//Peter\n"},{"id":"143865","messageId":"AANLkTileL-N2Q-90jcxKtQMkaPZob-slGevcorpBHXaj@mail.gmail.com","threadId":"24136","inReplyTo":"A612847CFE53224C91B23E3A5B48BAC74483CEEB16@xmail3.se.axis.com","subject":"Re: moving a remote branch?","fromName":"Nazri Ramliy","fromEmail":"ayiehere@gmail.com","sentAt":"2010-06-17T13:19:21Z","receivedAt":"2010-06-17T13:19:21Z","isPatch":false,"sender":{"key":"ayiehere@gmail.com","avatar":"https://avatars.githubusercontent.com/u/164756?v=4"},"body":"On Thu, Jun 17, 2010 at 9:02 PM, Peter Kjellerstedt >\n> No, you will not (at least not with git 1.7.1 that I use).\n>\n> Neither do you need to do the two steps below as the two pushes\n> above are enough to also keep the status of the remote branches\n> in sync in the local repository..\n>\n> //Peter\n\nAh, you are right. Thanks for the lesson.\n\nnazri.\n"},{"id":"143867","messageId":"AANLkTikbOLRc6BvXtO8vznFevj0V_iZr34U1QaHCfFBh@mail.gmail.com","threadId":"24136","inReplyTo":"A612847CFE53224C91B23E3A5B48BAC74483CEEA82@xmail3.se.axis.com","subject":"Re: moving a remote branch?","fromName":"Thomas Anderson","fromEmail":"zelnaga@gmail.com","sentAt":"2010-06-17T13:55:38Z","receivedAt":"2010-06-17T13:55:38Z","isPatch":false,"sender":{"key":"zelnaga@gmail.com","avatar":null},"body":"Do I need to switch to the local featurea branch before doing \"git\npush origin origin/featurea:refs/heads/featureb\" or can I do that\nwhile in the default branch?\n\nOn Thu, Jun 17, 2010 at 3:28 AM, Peter Kjellerstedt\n<peter.kjellerstedt@axis.com> wrote:\n>> -----Original Message-----\n>> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On\n>> Behalf Of Nazri Ramliy\n>> Sent: den 17 juni 2010 08:20\n>> To: Thomas Anderson\n>> Cc: git@vger.kernel.org\n>> Subject: Re: moving a remote branch?\n>>\n>> On Thu, Jun 17, 2010 at 12:35 PM, Thomas Anderson <zelnaga@gmail.com>\n>> wrote:\n>> > git branch -m origin/zelnaga/featurea origin/zelnaga/featureb doesn't\n>> > seem to be working for me.  Instead, I get this error:l\n>> >\n>> > error: refname refs/heads/origin/zelnaga/featurea\n>> > fatal: Branch rename failed\n>> >\n>> > Any ideas?\n>>\n>> The error  message could be improved here.\n>>\n>> The reason you get the error is because you were asking git\n>> to rename a \"remote\" branch, which it refuses to do because,\n>> well, it's a remote branch, and for all practical purposes git\n>> won't allow you to modify any \"remote\" stuff as they are all\n>> read-only from our point of view.\n>>\n>> If you run \"git remote -v\" you'll most likely see that \"origin\"\n>> is listed in the output which means that your \"origin/zelnaga/featurea\"\n>> is a remote branch because its name begin with \"origin/\".\n>>\n>> Hope this helps.\n>>\n>> nazri.\n>\n> Renaming a remote branch is a two step operation. First you push the\n> old branch into its new name, and then you remove the old branch. It\n> can be done with these commands:\n>\n>        git push origin origin/featurea:refs/heads/featureb\n>        git push origin :featurea\n>\n> //Peter\n>\n>\n"},{"id":"143870","messageId":"A612847CFE53224C91B23E3A5B48BAC74483CEEB6D@xmail3.se.axis.com","threadId":"24136","inReplyTo":"AANLkTikbOLRc6BvXtO8vznFevj0V_iZr34U1QaHCfFBh@mail.gmail.com","subject":"RE: moving a remote branch?","fromName":"Peter Kjellerstedt","fromEmail":"peter.kjellerstedt@axis.com","sentAt":"2010-06-17T15:05:33Z","receivedAt":"2010-06-17T15:05:33Z","isPatch":false,"sender":{"key":"peter.kjellerstedt@axis.com","avatar":"https://gravatar.com/avatar/6d5a0182283c8eccd7b134a54dbfd5f30038f3ad4d38b96f424884b614a61ca2?d=mp&s=160"},"body":"> -----Original Message-----\n> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On\n> Behalf Of Thomas Anderson\n> Sent: den 17 juni 2010 15:56\n> To: Peter Kjellerstedt\n> Cc: Nazri Ramliy; git@vger.kernel.org\n> Subject: Re: moving a remote branch?\n> \n> Do I need to switch to the local featurea branch before doing \"git\n> push origin origin/featurea:refs/heads/featureb\" or can I do that\n> while in the default branch?\n\nYou do not need to switch branch. The command above has all\nthe information it needs on the command line.\n\nOne thing to note though. If you have a local branch tracking\nthe remote featurea branch, it will not automatically start\ntracking the featureb branch when you rename the remote branch.\nYou will have to fix the tracking manually (either by setting\nup a new tracking branch for featureb, or by editing the\n.git/config file to reflect the new situation).\n\n//Peter\n"}]}