{"thread":{"id":"23792","subject":"how to push from repository with two tracking branches","startedAt":"2010-05-13T09:09:11Z","lastAt":"2010-05-13T12:12:58Z","messageCount":3,"participants":["Gelonida","Jeff King","Thomas Rast"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"141566","messageId":"hsgfjn$onv$1@dough.gmane.org","threadId":"23792","inReplyTo":null,"subject":"how to push from repository with two tracking branches","fromName":"Gelonida","fromEmail":"gelonida@gmail.com","sentAt":"2010-05-13T09:09:11Z","receivedAt":"2010-05-13T09:09:11Z","isPatch":false,"sender":{"key":"gelonida@gmail.com","avatar":null},"body":"Hi,\n\nI have a repository with two tracking branches ('master' and 'mybranch')\n\nwith only one tracking branch I can do\ngit pull\nmake_local_changes\ngit commit -a\ngit push\n\n\nwith two tracking branches I will be told off if the other branch has\nbeen updated meanwhile, so what I currently to do is:\n\n# 'pull and fastforward mybranch'\ngit checkout mybranch\ngit pull\ngit checkout master\n\n# pull and commit and push as with one tracking branch\ngit pull\nmake_local_changes\ngit commit -a\ngit push\n\n\nHow can I do this more efficiently?\nafter a pull to master (I just had to fast forward mybranch to\nremote/mybranch)\nSwitching branches and pulling seems a little clumsy\n\n\nN\n"},{"id":"141578","messageId":"20100513115747.GC10963@coredump.intra.peff.net","threadId":"23792","inReplyTo":"hsgfjn$onv$1@dough.gmane.org","subject":"Re: how to push from repository with two tracking branches","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-05-13T11:57:48Z","receivedAt":"2010-05-13T11:57:48Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, May 13, 2010 at 11:09:11AM +0200, Gelonida wrote:\n\n> I have a repository with two tracking branches ('master' and 'mybranch')\n> \n> with only one tracking branch I can do\n> git pull\n> make_local_changes\n> git commit -a\n> git push\n> \n> with two tracking branches I will be told off if the other branch has\n> been updated meanwhile, so what I currently to do is:\n\nHow about \"git push origin mybranch\" to just push mybranch? You might\nalso want to look at \"push.default\" in \"git help config\".\n\n> # 'pull and fastforward mybranch'\n> git checkout mybranch\n> git pull\n> git checkout master\n>\n> [...]\n>\n> How can I do this more efficiently?\n> after a pull to master (I just had to fast forward mybranch to\n> remote/mybranch)\n> Switching branches and pulling seems a little clumsy\n\nPull requires a working tree because a non-fast forward merge may need\nto resolve conflicts. So yes, you could be more efficient if it is a\nfast-forward (you would \"git fetch\", check to make sure it is a\nfast-forward, and then write the fast-forwarded commit sha1 into the\nref), but in the worst case you may need to actually do the merge.\n\n-Peff\n"},{"id":"141580","messageId":"201005131412.58675.trast@student.ethz.ch","threadId":"23792","inReplyTo":"20100513115747.GC10963@coredump.intra.peff.net","subject":"Re: how to push from repository with two tracking branches","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-05-13T12:12:58Z","receivedAt":"2010-05-13T12:12:58Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Jeff King wrote:\n> On Thu, May 13, 2010 at 11:09:11AM +0200, Gelonida wrote:\n> \n> > I have a repository with two tracking branches ('master' and 'mybranch')\n> > \n> > with only one tracking branch I can do\n> > git pull\n> > make_local_changes\n> > git commit -a\n> > git push\n> > \n> > with two tracking branches I will be told off if the other branch has\n> > been updated meanwhile, so what I currently to do is:\n> \n> How about \"git push origin mybranch\" to just push mybranch? You might\n> also want to look at \"push.default\" in \"git help config\".\n\nBesides, all successful branch updates go through independently of the\nones that failed.  So you can push without having all local branches\nup to date.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"}]}