{"thread":{"id":"23558","subject":"git push in --tracked branches.","startedAt":"2010-04-22T00:02:49Z","lastAt":"2010-04-22T19:52:16Z","messageCount":5,"participants":["Aghiles","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"140078","messageId":"y2w3abd05a91004211702qf4cd42bau20ac52a4d35a6bf1@mail.gmail.com","threadId":"23558","inReplyTo":null,"subject":"git push in --tracked branches.","fromName":"Aghiles","fromEmail":"aghilesk@gmail.com","sentAt":"2010-04-22T00:02:49Z","receivedAt":"2010-04-22T00:02:49Z","isPatch":false,"sender":{"key":"aghilesk@gmail.com","avatar":null},"body":"So I created a branch that tracks 'origin' which is remote:\n\n  git checkout -b small_fixes origin\n\nI can do a 'git pull' and everything works as expected. I did some\ncommits in this branch and I issue a 'git push'. To my surprise\nthe 'git push' is still operating on the master and not the current\n'small_fixes' branch! What is the rationale behind this ? I would\nexpect to push from my current branch to origin (especially that\nI am --tracking origin).\n\n  -- aghiles\n"},{"id":"140086","messageId":"20100422004433.GC14249@coredump.intra.peff.net","threadId":"23558","inReplyTo":"y2w3abd05a91004211702qf4cd42bau20ac52a4d35a6bf1@mail.gmail.com","subject":"Re: git push in --tracked branches.","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-04-22T00:44:33Z","receivedAt":"2010-04-22T00:44:33Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Apr 21, 2010 at 08:02:49PM -0400, Aghiles wrote:\n\n> So I created a branch that tracks 'origin' which is remote:\n> \n>   git checkout -b small_fixes origin\n> \n> I can do a 'git pull' and everything works as expected. I did some\n> commits in this branch and I issue a 'git push'. To my surprise\n> the 'git push' is still operating on the master and not the current\n> 'small_fixes' branch! What is the rationale behind this ? I would\n> expect to push from my current branch to origin (especially that\n> I am --tracking origin).\n\n\"git push\" will by default push matching refs. This has been the\nbehavior since day one. See the description of push.default in \"git help\nconfig\" for other options (I think you want \"tracking\").\n\n-Peff\n"},{"id":"140087","messageId":"i2n3abd05a91004211813t8111c77am381bc0b8226a0c9b@mail.gmail.com","threadId":"23558","inReplyTo":"20100422004433.GC14249@coredump.intra.peff.net","subject":"Re: git push in --tracked branches.","fromName":"Aghiles","fromEmail":"aghilesk@gmail.com","sentAt":"2010-04-22T01:13:14Z","receivedAt":"2010-04-22T01:13:14Z","isPatch":false,"sender":{"key":"aghilesk@gmail.com","avatar":null},"body":"On Wed, Apr 21, 2010, Jeff King <peff@peff.net> wrote:\n\n> \"git push\" will by default push matching refs. This has been the\n> behavior since day one. See the description of push.default in \"git help\n> config\" for other options (I think you want \"tracking\").\n\nThank you very much. The 'tracking' case is what I need. Could you\nenlighten me why pushing all matching branches is a sensible default ?\nIt seems like an unusual thing to do.\n\n  -- aghiles\n"},{"id":"140090","messageId":"20100422015251.GA25093@coredump.intra.peff.net","threadId":"23558","inReplyTo":"i2n3abd05a91004211813t8111c77am381bc0b8226a0c9b@mail.gmail.com","subject":"Re: git push in --tracked branches.","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-04-22T01:52:51Z","receivedAt":"2010-04-22T01:52:51Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Apr 21, 2010 at 09:13:14PM -0400, Aghiles wrote:\n\n> On Wed, Apr 21, 2010, Jeff King <peff@peff.net> wrote:\n> \n> > \"git push\" will by default push matching refs. This has been the\n> > behavior since day one. See the description of push.default in \"git help\n> > config\" for other options (I think you want \"tracking\").\n> \n> Thank you very much. The 'tracking' case is what I need. Could you\n> enlighten me why pushing all matching branches is a sensible default ?\n> It seems like an unusual thing to do.\n\nI think it comes from a workflow where you tend to have a private repo\nand then a personal public repo for publishing. The matching refs are\nthen the set of refs that you have previously pushed. So you do:\n\n  $ git push public foo ;# publish \"foo\" for the first time\n  $ git push public ;# now \"foo\" will be published every time\n\nAnd you probably do work on topic branches, and only merge them into\nyour public branches when they are ready to show the world. So push is\nreally about synchronizing those public branches.\n\nIf you are working by cloning from a collaborative central repository,\nthen that workflow doesn't make as much sense. The refs on the other end\nare not about \"things I have published before\" but rather \"the set of\nall refs that our group agrees about\". And probably your workflow is to\nhack on a specific ref, and then push changes to that ref.\n\nGit grew out of the first type of workflow, and that has always been the\ndefault. Tools for helping the latter workflow have developed later.\nThere was some discussion about changing the default, but it hurts\npeople used to the current default, so we ended up with the config\nvariable.\n\nThat is just my two cents, though. I have largely stayed out of the\ndebates which seem to come up every once in a while. I think this thread\nis the one that lead to push.default:\n\n  http://article.gmane.org/gmane.comp.version-control.git/111375\n\n-Peff\n"},{"id":"140150","messageId":"m2r3abd05a91004221252u497174bfi8a49215ad496295d@mail.gmail.com","threadId":"23558","inReplyTo":"20100422015251.GA25093@coredump.intra.peff.net","subject":"Re: git push in --tracked branches.","fromName":"Aghiles","fromEmail":"aghilesk@gmail.com","sentAt":"2010-04-22T19:52:16Z","receivedAt":"2010-04-22T19:52:16Z","isPatch":false,"sender":{"key":"aghilesk@gmail.com","avatar":null},"body":"Hello Jeff,\n\n> Git grew out of the first type of workflow, and that has always been the\n> default. Tools for helping the latter workflow have developed later.\n> There was some discussion about changing the default, but it hurts\n> people used to the current default, so we ended up with the config\n> variable.\n\nThank you for the explanation. For what it's worth (probably 0) I vote\nfor the default to be 'tracking'.\n\n  -- aghiles\n"}]}