{"thread":{"id":"18160","subject":"setting up tracking on push","startedAt":"2009-03-06T03:07:29Z","lastAt":"2009-03-24T09:58:06Z","messageCount":38,"participants":["Miles Bader","John Tapsell","Jay Soffian","Johannes Schindelin","Jeremy O'Brien","Marc Branchaud","Jeff King","Junio C Hamano","Nanako Shiraishi","John M. Dlugosz","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"107133","messageId":"buofxhr2vta.fsf@dhlpc061.dev.necel.com","threadId":"18160","inReplyTo":null,"subject":"setting up tracking on push","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2009-03-06T03:07:29Z","receivedAt":"2009-03-06T03:07:29Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"[...sorry if this is a dup -- my previous attempt didn't seem to take...]\n\nIs there an \"easy\" way to set up tracking for a branch which starts out\nlocally, and is eventually pushed to a remote?\n\nE.g., I create a new local branch \"grognul\", and then later propagate it\nto my remote site using:\n\n  git push origin grognul\n\nThat works great (creating origin/grognul), but to set up tracking, I\ncurrently edit .git/config (not insanely difficult, but vaguely\nannoying).  This is as opposed to a branch which starts out remotely,\nand is pulled, where one can just use \"git branch --track\" or \"git\ncheckout --track\" (or use a config option to do so by default).\n\nI vaguely feel like I should be able to do:\n\n  git push --track origin grognul\n\n[I do this particular action -- creating a branch locally and then\npushing it to origin -- very very often, thus my desire for a handy\noption.]\n\nWhat do other people think?\n\n-miles\n\n--\nInhumanity, n. One of the signal and characteristic qualities of humanity.\n"},{"id":"107134","messageId":"43d8ce650903051917r2919becckf13171c8e015b652@mail.gmail.com","threadId":"18160","inReplyTo":"buofxhr2vta.fsf@dhlpc061.dev.necel.com","subject":"Re: setting up tracking on push","fromName":"John Tapsell","fromEmail":"johnflux@gmail.com","sentAt":"2009-03-06T03:17:58Z","receivedAt":"2009-03-06T03:17:58Z","isPatch":false,"sender":{"key":"johnflux@gmail.com","avatar":"https://gravatar.com/avatar/25f70d4c0f96396b84a2e34bcd9bdc233462c7b4be29b5fdca8266fc53f30b0c?d=mp&s=160"},"body":"2009/3/6 Miles Bader <miles@gnu.org>:\n> [...sorry if this is a dup -- my previous attempt didn't seem to take...]\n>\n> Is there an \"easy\" way to set up tracking for a branch which starts out\n> locally, and is eventually pushed to a remote?\n>\n> E.g., I create a new local branch \"grognul\", and then later propagate it\n> to my remote site using:\n>\n>  git push origin grognul\n>\n> That works great (creating origin/grognul), but to set up tracking, I\n> currently edit .git/config (not insanely difficult, but vaguely\n> annoying).  This is as opposed to a branch which starts out remotely,\n> and is pulled, where one can just use \"git branch --track\" or \"git\n> checkout --track\" (or use a config option to do so by default).\n>\n> I vaguely feel like I should be able to do:\n>\n>  git push --track origin grognul\n>\n> [I do this particular action -- creating a branch locally and then\n> pushing it to origin -- very very often, thus my desire for a handy\n> option.]\n>\n> What do other people think?\n\nI got bitten by this too, and there's no clue given how to set up the\ntracking.  I'd like it to even ask the user when pushing:\n\n$ git push origin grognul\nPushing blah blah...\n Do you want to track this? [Y/N/?]\n\n:-)\n\nJohn\n\n>\n> -miles\n>\n> --\n> Inhumanity, n. One of the signal and characteristic qualities of humanity.\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"107139","messageId":"76718490903052049k217e9c12gb7881f8904fdd9d@mail.gmail.com","threadId":"18160","inReplyTo":"buofxhr2vta.fsf@dhlpc061.dev.necel.com","subject":"Re: setting up tracking on push","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-06T04:49:42Z","receivedAt":"2009-03-06T04:49:42Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Thu, Mar 5, 2009 at 10:07 PM, Miles Bader <miles@gnu.org> wrote:\n> I vaguely feel like I should be able to do:\n>\n>  git push --track origin grognul\n\nHmm, I vaguely remember seeing a patch come across the list to do this.\n\nj.\n"},{"id":"107180","messageId":"alpine.DEB.1.00.0903061144480.10279@pacific.mpi-cbg.de","threadId":"18160","inReplyTo":"76718490903052049k217e9c12gb7881f8904fdd9d@mail.gmail.com","subject":"Re: setting up tracking on push","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-03-06T10:45:56Z","receivedAt":"2009-03-06T10:45:56Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 5 Mar 2009, Jay Soffian wrote:\n\n> On Thu, Mar 5, 2009 at 10:07 PM, Miles Bader <miles@gnu.org> wrote:\n> > I vaguely feel like I should be able to do:\n> >\n> >  git push --track origin grognul\n> \n> Hmm, I vaguely remember seeing a patch come across the list to do this.\n\nIndeed.\n\nhttp://search.gmane.org/?query=push+track&group=gmane.comp.version-control.git\n\nSummary for the lazy: it needs a lot of work to be implemented properly.\n\nHth,\nDscho\n"},{"id":"107184","messageId":"buoy6vi297q.fsf@dhlpc061.dev.necel.com","threadId":"18160","inReplyTo":"alpine.DEB.1.00.0903061144480.10279@pacific.mpi-cbg.de","subject":"Re: setting up tracking on push","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2009-03-06T11:15:37Z","receivedAt":"2009-03-06T11:15:37Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>> > I vaguely feel like I should be able to do:\n>> >\n>> >  git push --track origin grognul\n>\n> http://search.gmane.org/?query=push+track&group=gmane.comp.version-control.git\n>\n> Summary for the lazy: it needs a lot of work to be implemented properly.\n\nAlternatively, maybe a \"git track [REMOTE [BRANCH]]\" command that simply\nadds makes adding the appropriate config magic more convenient ?\n\nI dunno what the arg syntax would look like in the general case;\nI almost always want to use the current branch, and track an identically\nnamed branch in the origin remote though...\n\n-Miles\n\n-- \nCustard, n. A vile concoction produced by a malevolent conspiracy of the hen,\nthe cow, and the cook.\n"},{"id":"107201","messageId":"49b12ff7.nCWIz4ABJcgwW3BZ%obrien654j@gmail.com","threadId":"18160","inReplyTo":"buoy6vi297q.fsf@dhlpc061.dev.necel.com","subject":"Re: setting up tracking on push","fromName":"Jeremy O'Brien","fromEmail":"obrien654j@gmail.com","sentAt":"2009-03-06T14:15:19Z","receivedAt":"2009-03-06T14:15:19Z","isPatch":false,"sender":{"key":"obrien654j@gmail.com","avatar":"https://gravatar.com/avatar/5c9159e1ccac9be7207778ee0115f17ba6193550017cad0d2454d2da04089a15?d=mp&s=160"},"body":"Miles Bader <miles@gnu.org> wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> >> > I vaguely feel like I should be able to do:\n> >> >\n> >> >  git push --track origin grognul\n> >\n> > http://search.gmane.org/?query=push+track&group=gmane.comp.version-control.git\n> >\n> > Summary for the lazy: it needs a lot of work to be implemented properly.\n>\n> Alternatively, maybe a \"git track [REMOTE [BRANCH]]\" command that simply\n> adds makes adding the appropriate config magic more convenient ?\n>\n> I dunno what the arg syntax would look like in the general case;\n> I almost always want to use the current branch, and track an identically\n> named branch in the origin remote though...\n>\n> -Miles\n\nI definitely second this approach. It would be very useful.\n"},{"id":"107213","messageId":"76718490903060743m425c2d55n6e8737c893c936e8@mail.gmail.com","threadId":"18160","inReplyTo":"49b12ff7.nCWIz4ABJcgwW3BZ%obrien654j@gmail.com","subject":"Re: setting up tracking on push","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-06T15:43:17Z","receivedAt":"2009-03-06T15:43:17Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Fri, Mar 6, 2009 at 9:15 AM, Jeremy O'Brien <obrien654j@gmail.com> wrote:\n> Miles Bader <miles@gnu.org> wrote:\n>\n>> Alternatively, maybe a \"git track [REMOTE [BRANCH]]\" command that simply\n>> adds makes adding the appropriate config magic more convenient ?\n>>\n>> I dunno what the arg syntax would look like in the general case;\n>> I almost always want to use the current branch, and track an identically\n>> named branch in the origin remote though...\n\nI don't think we need a new command, but it would probably fit into git remote\n\n$ git remote track <remote> [<branch>]\n\nj.\n"},{"id":"107224","messageId":"87d4cuobrc.fsf@catnip.gol.com","threadId":"18160","inReplyTo":"76718490903060743m425c2d55n6e8737c893c936e8@mail.gmail.com","subject":"Re: setting up tracking on push","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2009-03-06T16:29:43Z","receivedAt":"2009-03-06T16:29:43Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"Jay Soffian <jaysoffian@gmail.com> writes:\n> I don't think we need a new command, but it would probably fit into\n> git remote\n>\n> $ git remote track <remote> [<branch>]\n\nThat seems a bit backwards -- it's more of a branch operation than a\nremote operation...\n\n-Miles\n\n-- \nMayonnaise, n. One of the sauces that serve the French in place of a state\nreligion.\n"},{"id":"107609","messageId":"49B6CCDB.8010305@xiplink.com","threadId":"18160","inReplyTo":"87d4cuobrc.fsf@catnip.gol.com","subject":"Re: setting up tracking on push","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2009-03-10T20:26:03Z","receivedAt":"2009-03-10T20:26:03Z","isPatch":false,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"Miles Bader wrote:\n> Jay Soffian <jaysoffian@gmail.com> writes:\n>> I don't think we need a new command, but it would probably fit into\n>> git remote\n>>\n>> $ git remote track <remote> [<branch>]\n> \n> That seems a bit backwards -- it's more of a branch operation than a\n> remote operation...\n\nAgreed.\n\nWe just ran into this situation today with pull: Someone wanted one of their local branches to start tracking a remote.\n\nIt would be good if the branch command allowed modification of a branch's properties.  At the very least, branch-creation commands like \"git branch --track foobranch origin/master\" could offer to modify if the branch already exists, instead of just quitting.\n\nBTW, I think the following (untested) incantation adds tracking to a branch:\n\n\tgit config branch.foobranch.remote origin\n\tgit config branch.foobranch.merge refs/heads/master\n\n(Substitute \"origin\" and \"master\" to suit your needs.)\n\n\t\tM.\n"},{"id":"107617","messageId":"20090310230939.GB14083@sigio.peff.net","threadId":"18160","inReplyTo":"49B6CCDB.8010305@xiplink.com","subject":"Re: setting up tracking on push","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-10T23:09:39Z","receivedAt":"2009-03-10T23:09:39Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 10, 2009 at 04:26:03PM -0400, Marc Branchaud wrote:\n\n> It would be good if the branch command allowed modification of a\n> branch's properties.  At the very least, branch-creation commands like\n> \"git branch --track foobranch origin/master\" could offer to modify if\n> the branch already exists, instead of just quitting.\n\nI agree that it would be nice if an interface could be made around\n\"branch --track\". However, the problem with\n\n  git branch --track foobranch origin/master\n\nis that it does two things: it sets up tracking, and it resets the\nfoobranch ref. Right now we complain if foobranch already exists. We\nhave a \"-f\" to override. But what you want to say is \"set foobranch to\ntrack origin/master, but _don't_ actually reset where it points\". And I\ndon't see an intuitive way of doing that with that syntax. If you don't\nrequire \"-f\", then you are silently ignoring half of what the user asked\nyou to do.\n\n> BTW, I think the following (untested) incantation adds tracking to a branch:\n>\n> \tgit config branch.foobranch.remote origin\n> \tgit config branch.foobranch.merge refs/heads/master\n\nYes, that is right. The only reason it is not a two-line script to\nconvert \"git branch --track\" into that is that you have to actually\nresolve origin/master into \"remote origin, branch refs/heads/master\".\n\n-Peff\n"},{"id":"107627","messageId":"76718490903101852y2c90e0abi8e0e4f71e6f0bc52@mail.gmail.com","threadId":"18160","inReplyTo":"20090310230939.GB14083@sigio.peff.net","subject":"Re: setting up tracking on push","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-11T01:52:44Z","receivedAt":"2009-03-11T01:52:44Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Tue, Mar 10, 2009 at 7:09 PM, Jeff King <peff@peff.net> wrote:\n> On Tue, Mar 10, 2009 at 04:26:03PM -0400, Marc Branchaud wrote:\n>\n>> It would be good if the branch command allowed modification of a\n>> branch's properties.  At the very least, branch-creation commands like\n>> \"git branch --track foobranch origin/master\" could offer to modify if\n>> the branch already exists, instead of just quitting.\n>\n> I agree that it would be nice if an interface could be made around\n> \"branch --track\". However, the problem with\n>\n>  git branch --track foobranch origin/master\n>\n> is that it does two things: it sets up tracking, and it resets the\n> foobranch ref. Right now we complain if foobranch already exists. We\n> have a \"-f\" to override. But what you want to say is \"set foobranch to\n> track origin/master, but _don't_ actually reset where it points\". And I\n> don't see an intuitive way of doing that with that syntax. If you don't\n> require \"-f\", then you are silently ignoring half of what the user asked\n> you to do.\n\nMaybe a new switch, say -u for update:\n\n-u --track [<branch>] <upstream>\n\nUpdate tracking information for an existing branch. <branch> is\noptional and defaults to the current branch. <upstream> is the branch\nyou wish to track, e.g. origin/master; normally <upstream> is a remote\ntracking branch, but specifying a local branch is valid as well.\n\n-u --no-track [<branch>]\n\nRemove tracking information for an existing branch. <branch> is\noptional and defaults to the current branch.\n\nj.\n"},{"id":"107630","messageId":"20090311020409.GA31365@coredump.intra.peff.net","threadId":"18160","inReplyTo":"76718490903101852y2c90e0abi8e0e4f71e6f0bc52@mail.gmail.com","subject":"Re: setting up tracking on push","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-11T02:04:09Z","receivedAt":"2009-03-11T02:04:09Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 10, 2009 at 09:52:44PM -0400, Jay Soffian wrote:\n\n> Maybe a new switch, say -u for update:\n> \n> -u --track [<branch>] <upstream>\n> \n> Update tracking information for an existing branch. <branch> is\n> optional and defaults to the current branch. <upstream> is the branch\n> you wish to track, e.g. origin/master; normally <upstream> is a remote\n> tracking branch, but specifying a local branch is valid as well.\n> \n> -u --no-track [<branch>]\n> \n> Remove tracking information for an existing branch. <branch> is\n> optional and defaults to the current branch.\n\nHmm. This seems not quite right to me. Specifically:\n\n  1. Would you ever want to use \"-u\" without \"--track\"? If so, then why\n     are they two separate options?\n\n  2. In your example, if I give only a single non-option argument, it is\n     interpreted as the upstream (and presumably the branch defaults to\n     HEAD).  But in other branch commands, it is interpreted as the\n     branch, and the upstream defaults to HEAD.\n\nFor (1), you could just have a single option. Unfortunately --track is\ntaken. But maybe you could do --track=. And that helps with (2), as\nwell, since this syntax would only ever have one or zero arguments. And\nthen you can default zero to HEAD.\n\nIOW:\n\n  # track origin/master with the current branch\n  git branch --track=origin/master\n\n  # track origin/master with a different branch\n  git branch --track=origin/master other_branch\n\n  # stop tracking\n  git branch --track=\n\nThe only two problems I can think of are:\n\n  1. It is perhaps a little confusing that --track= means \"don't do the\n     normal branch operation, but instead do this totally different\n     thing. Of course we already have a similar situation with \"-m\", but\n     it is perhaps more confusing since \"--track\" and \"--track=\" have\n     totally different semantics.\n\n  2. This would be the only branch command to operate on HEAD if given\n     no argument. That isn't necessary for this proposal, but I think it\n     makes it nicer to use. An alternative would be for git-branch to\n     resolve symrefs (which would also be nice for \"git branch -m HEAD\n     foo\").\n\n-Peff\n"},{"id":"107632","messageId":"76718490903101959i61df26aagdff44bb9ab4593ab@mail.gmail.com","threadId":"18160","inReplyTo":"20090311020409.GA31365@coredump.intra.peff.net","subject":"Re: setting up tracking on push","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-11T02:59:01Z","receivedAt":"2009-03-11T02:59:01Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Tue, Mar 10, 2009 at 10:04 PM, Jeff King <peff@peff.net> wrote:\n>\n>> -u --track [<branch>] <upstream>\n>\n> Hmm. This seems not quite right to me. Specifically:\n>\n>  1. Would you ever want to use \"-u\" without \"--track\"? If so, then why\n>     are they two separate options?\n\nFor when branch grows additional long options that update, er,\nsomething else. :-)\n\nAnd you can also use it with --no-track.\n\nBut the primary reason for the -u is to differentiate the operation,\njust like -m and -d.\n\n>  2. In your example, if I give only a single non-option argument, it is\n>     interpreted as the upstream (and presumably the branch defaults to\n>     HEAD).  But in other branch commands, it is interpreted as the\n>     branch, and the upstream defaults to HEAD.\n\nNo, look at how -m works. [<oldbranch>] <newbranch>. I modeled it after that.\n\n> For (1), you could just have a single option. Unfortunately --track is\n> taken. But maybe you could do --track=. And that helps with (2), as\n> well, since this syntax would only ever have one or zero arguments. And\n> then you can default zero to HEAD.\n>\n> IOW:\n>\n>  # track origin/master with the current branch\n>  git branch --track=origin/master\n>\n>  # track origin/master with a different branch\n>  git branch --track=origin/master other_branch\n>\n>  # stop tracking\n>  git branch --track=\n>\n> The only two problems I can think of are:\n>\n>  1. It is perhaps a little confusing that --track= means \"don't do the\n>     normal branch operation, but instead do this totally different\n>     thing. Of course we already have a similar situation with \"-m\", but\n>     it is perhaps more confusing since \"--track\" and \"--track=\" have\n>     totally different semantics.\n>\n>  2. This would be the only branch command to operate on HEAD if given\n>     no argument. That isn't necessary for this proposal, but I think it\n>     makes it nicer to use. An alternative would be for git-branch to\n>     resolve symrefs (which would also be nice for \"git branch -m HEAD\n>     foo\").\n\nYeah, I like that less than -u, which I agree isn't perfect, but I\nthink it's closer.\n\nj.\n"},{"id":"107633","messageId":"20090311030604.GA3044@coredump.intra.peff.net","threadId":"18160","inReplyTo":"76718490903101959i61df26aagdff44bb9ab4593ab@mail.gmail.com","subject":"Re: setting up tracking on push","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-11T03:06:04Z","receivedAt":"2009-03-11T03:06:04Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 10, 2009 at 10:59:01PM -0400, Jay Soffian wrote:\n\n> But the primary reason for the -u is to differentiate the operation,\n> just like -m and -d.\n\nOK, that at least makes a bit of sense to me.\n\n> >  2. In your example, if I give only a single non-option argument, it is\n> >     interpreted as the upstream (and presumably the branch defaults to\n> >     HEAD).  But in other branch commands, it is interpreted as the\n> >     branch, and the upstream defaults to HEAD.\n> \n> No, look at how -m works. [<oldbranch>] <newbranch>. I modeled it after that.\n\nHmm. I think of that as \"make <newbranch>, move from <oldbranch> or\nHEAD\". Just as regular branch is \"make <newbranch>, start from\n<oldbranch> or HEAD\". But your proposal is \"update <newbranch> or HEAD,\nfrom <oldbranch>\".\n\nIf \"-u\" is supposed to be a general mode, then what does it mean to say:\n\n  git branch -u foo\n\n? I would expect that to \"update\" foo. But if --track is given, then it\nmeans \"update HEAD to track foo\".\n\n-Peff\n"},{"id":"107635","messageId":"76718490903102040m6bfb45f1xfd7ff3d53a79ef5b@mail.gmail.com","threadId":"18160","inReplyTo":"20090311030604.GA3044@coredump.intra.peff.net","subject":"Re: setting up tracking on push","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-11T03:40:29Z","receivedAt":"2009-03-11T03:40:29Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Tue, Mar 10, 2009 at 11:06 PM, Jeff King <peff@peff.net> wrote:\n> If \"-u\" is supposed to be a general mode, then what does it mean to say:\n>\n>  git branch -u foo\n\nNothing, that would emit the usage message since it's not valid.\n\n> ? I would expect that to \"update\" foo. But if --track is given, then it\n> means \"update HEAD to track foo\".\n\nMaybe branch isn't the best place to put this feature, but it's where\nI'd look. I'm not married to -u, it was just the first thing that came\nto mind. But I still can't think of anything better.\n\nj.\n"},{"id":"107636","messageId":"76718490903102044j4ca3462eye5ffcb178608dc29@mail.gmail.com","threadId":"18160","inReplyTo":"20090311030604.GA3044@coredump.intra.peff.net","subject":"Re: setting up tracking on push","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-11T03:44:14Z","receivedAt":"2009-03-11T03:44:14Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Tue, Mar 10, 2009 at 11:06 PM, Jeff King <peff@peff.net> wrote:\n>> No, look at how -m works. [<oldbranch>] <newbranch>. I modeled it after that.\n>\n> Hmm. I think of that as \"make <newbranch>, move from <oldbranch> or\n> HEAD\".\n\nUm, I think of it as \"rename <oldbranch> to <newbranch>\" where\n<oldbranch> defaults to the current branch (aka HEAD).\n\n> Just as regular branch is \"make <newbranch>, start from\n> <oldbranch> or HEAD\". But your proposal is \"update <newbranch> or HEAD,\n> from <oldbranch>\".\n\nWait, what? No it isn't. My proposal is add or remove tracking\ninformation to <branch> where <branch> defaults to the current branch\n(aka HEAD).\n\n-u w/o --track/--no-track is a usage error.\n\nj.\n"},{"id":"107637","messageId":"20090311035701.GA6089@coredump.intra.peff.net","threadId":"18160","inReplyTo":"76718490903102044j4ca3462eye5ffcb178608dc29@mail.gmail.com","subject":"Re: setting up tracking on push","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-11T03:57:02Z","receivedAt":"2009-03-11T03:57:02Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 10, 2009 at 11:44:14PM -0400, Jay Soffian wrote:\n\n> > Hmm. I think of that as \"make <newbranch>, move from <oldbranch> or\n> > HEAD\".\n> \n> Um, I think of it as \"rename <oldbranch> to <newbranch>\" where\n> <oldbranch> defaults to the current branch (aka HEAD).\n\nPerhaps it is because it was added onto \"git branch\" which already had\nan existing syntax and meaning, but I have always seen it as \"operating\"\non the new branch.\n\nThere was some debate about this when \"-m\" came about (with respect to\nthe order of arguments).\n\nSo I think it is largely a matter of perception and mental model.\n\n> -u w/o --track/--no-track is a usage error.\n\nThen what is the point of \"-u\"? You said before that it was a new\noperation with room for future growth of additional options. Either it\nis _just_ for --track, in which case I think you are better to have a\nsingle option representing the notion of \"update the tracking setup\", or\nit isn't, in which case it needs to have room for future expansion.\n\n-Peff\n"},{"id":"107638","messageId":"76718490903102115x27a869f2la0d5ca9003bcc95a@mail.gmail.com","threadId":"18160","inReplyTo":"20090311035701.GA6089@coredump.intra.peff.net","subject":"Re: setting up tracking on push","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-11T04:15:12Z","receivedAt":"2009-03-11T04:15:12Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Tue, Mar 10, 2009 at 11:57 PM, Jeff King <peff@peff.net> wrote:\n>> -u w/o --track/--no-track is a usage error.\n>\n> Then what is the point of \"-u\"? You said before that it was a new\n> operation with room for future growth of additional options. Either it\n> is _just_ for --track, in which case I think you are better to have a\n> single option representing the notion of \"update the tracking setup\", or\n> it isn't, in which case it needs to have room for future expansion.\n\nFor *now*, it is just for --track/--no-track, since I can't think of\nanything sensible that \"-u\" without --track nor --no-track would do.\n\nSo it means, update the branch config, but you have to tell it what\naspect of the branch config to update.\n\nI agree that currently, a single option could do here, but I can't\nthink of a good one. --add-tracking and --delete-tracking? I was\ntrying to re-use the fact that we already have --track and --no-track,\nbut I needed some way to differentiate the mode from \"create a new\nbranch\". Hence -u.\n\nj.\n"},{"id":"107641","messageId":"7vwsaw7jzy.fsf@gitster.siamese.dyndns.org","threadId":"18160","inReplyTo":"20090311020409.GA31365@coredump.intra.peff.net","subject":"Re: setting up tracking on push","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-11T04:37:21Z","receivedAt":"2009-03-11T04:37:21Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n>   # track origin/master with a different branch\n>   git branch --track=origin/master other_branch\n\nIsn't this one confusing with \"git branch other_branch origin/master\" (I\nthought --track is the default these days)?\n\nIn any case, I find these \"branch --retrack\" proposals too confusing and\nprobably overengineered.\n\nI need to ask a more fundamental question.  Is it really useful for people\nto be able to re-track arbitrary remote/branch with an existing branch?\n\nThe only use case I've heard in this thread and nearby is where you are\nthe one who started the history of the branch, and pushed it into a public\nrepository as a new branch, making the result _the_ most authoritative\none.  After that, everybody else will be able to have a local branch that\ntracks the authoritative one with \"branch --track frotz origin/frotz\", and\nyou will be the only one left unable to do so because you already have\nthat frotz branch.\n\nAnd for that use case, I find it sensible if we had a way to easily say\n\"This branch hasn't been tracking anything so far (because it is the\noriginator of the history), but now it will give up its authority and\nstart tracking the one it is pushing into\", and it would make sense to\nsomehow link that to the invocation of \"git push\".\n\n    Side note.  I would also accept \"It is only one person in the world,\n    who can edit .git/config and be done with it; why bother complicate\n    the UI for other people\" as a valid argument against it, though ;-).\n\nIn that \"my private branch gave autority to the branch at my public\nrepository\" case, it is of course easy to re-clone (or \"branch -m\" away\nand then re-fetch) like everybody else, but then you would lose the reflog\nfrom the time before the branch went public, so it is not a solution but a\npoor workaround.\n\nI somehow think it would not make any sense to say \"This branch used to\ntrack that branch but now it will start tracking this other one\".  People\nof course can come up with contrived example to claim it is a useful\noperation, but in real life, would it really be?  \"The authoritative\nrepository has moved\" is not an example.  It would merely be a change in\nremote.<name>.url.  \"The upstream renamed the branch\" is not an example\neither.  It falls into \"Don't do that, then.  It will confuse everybody\"\ncase.\n"},{"id":"107643","messageId":"fc339e4a0903102156q4b61b712j6c7b4daaef6f163@mail.gmail.com","threadId":"18160","inReplyTo":"7vwsaw7jzy.fsf@gitster.siamese.dyndns.org","subject":"Re: setting up tracking on push","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2009-03-11T04:56:52Z","receivedAt":"2009-03-11T04:56:52Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"On Wed, Mar 11, 2009 at 1:37 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> And for that use case, I find it sensible if we had a way to easily say\n> \"This branch hasn't been tracking anything so far (because it is the\n> originator of the history), but now it will give up its authority and\n> start tracking the one it is pushing into\", and it would make sense to\n> somehow link that to the invocation of \"git push\".\n\nI agree, and that's the use-case that prompted my original query.  I\nvery often create a new branch locally, and later push it to origin\nwith an intent to subsequently keep it synced with the new remote\nbranch.\n\n-Miles\n\n-- \nDo not taunt Happy Fun Ball.\n"},{"id":"107644","messageId":"buobps81wj1.fsf@dhlpc061.dev.necel.com","threadId":"18160","inReplyTo":"fc339e4a0903102156q4b61b712j6c7b4daaef6f163@mail.gmail.com","subject":"Re: setting up tracking on push","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2009-03-11T05:03:14Z","receivedAt":"2009-03-11T05:03:14Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"Miles Bader <miles@gnu.org> writes:\n> I agree, and that's the use-case that prompted my original query.  I\n> very often create a new branch locally, and later push it to origin\n> with an intent to subsequently keep it synced with the new remote\n> branch.\n\nOh, and I also always use the syntax:\n\n   git push origin BRANCH_NAME\n\nAs the (apparent) objection adding \"git push --track\" was the question\nof what the behavior would be in the general case (where lots of\nbranches can be pushed), maybe restricting \"--track\" to only specific\ncases would be a possible solution?\n\n-Miles\n\n-- \n97% of everything is grunge\n"},{"id":"107645","messageId":"76718490903102222n23e0e7fdlcee2888333a2b912@mail.gmail.com","threadId":"18160","inReplyTo":"7vwsaw7jzy.fsf@gitster.siamese.dyndns.org","subject":"Re: setting up tracking on push","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-11T05:22:26Z","receivedAt":"2009-03-11T05:22:26Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Wed, Mar 11, 2009 at 12:37 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> I need to ask a more fundamental question.  Is it really useful for people\n> to be able to re-track arbitrary remote/branch with an existing branch?\n\nActually, for me, I find sometimes I've forgotten to setup tracking,\nor I've setup tracking and don't want it. I just fire up an editor on\n.git/config, or use git config, but I would appreciate an easy way to\nadd/remove tracking to a branch after the fact.\n\nj.\n"},{"id":"107649","messageId":"20090311063254.GA1324@sigill.intra.peff.net","threadId":"18160","inReplyTo":"7vwsaw7jzy.fsf@gitster.siamese.dyndns.org","subject":"Re: setting up tracking on push","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-11T06:32:54Z","receivedAt":"2009-03-11T06:32:54Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 10, 2009 at 09:37:21PM -0700, Junio C Hamano wrote:\n\n> In any case, I find these \"branch --retrack\" proposals too confusing and\n> probably overengineered.\n\nI agree. I was hoping to find something that _wasn't_ confusing, but I\ndon't think we've succeeded.\n\n> I need to ask a more fundamental question.  Is it really useful for people\n> to be able to re-track arbitrary remote/branch with an existing branch?\n\nI do it occasionally, but I have never had a problem with editing\n.git/config.\n\nMy use case is usually something like:\n\n  1. make an experimental commit on some long-running branch like 'next'\n     or 'master'\n\n  2. realize it's going to take several commits and would work better as\n     a topic branch\n\n  3. git checkout -b topic\n\nin which case I have no tracking setup. But if I had realized it was\ngoing to be a topic in the first place and done \"git checkout -b topic\norigin/master\" then I would.\n\nBut again, I don't have a problem with editing .git/config. I was trying\nin this thread to respond to user request.\n\n-Peff\n"},{"id":"107662","messageId":"20090311190207.6117@nanako3.lavabit.com","threadId":"18160","inReplyTo":"7vwsaw7jzy.fsf@gitster.siamese.dyndns.org","subject":"Re: setting up tracking on push","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-03-11T10:02:07Z","receivedAt":"2009-03-11T10:02:07Z","isPatch":false,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Junio C Hamano <gitster@pobox.com>:\n\n> The only use case I've heard in this thread and nearby is where you are\n> the one who started the history of the branch, and pushed it into a public\n> repository as a new branch, making the result _the_ most authoritative\n> one.  After that, everybody else will be able to have a local branch that\n> tracks the authoritative one with \"branch --track frotz origin/frotz\", and\n> you will be the only one left unable to do so because you already have\n> that frotz branch.\n>\n> And for that use case, I find it sensible if we had a way to easily say\n> \"This branch hasn't been tracking anything so far (because it is the\n> originator of the history), but now it will give up its authority and\n> start tracking the one it is pushing into\", and it would make sense to\n> somehow link that to the invocation of \"git push\".\n>\n>     Side note.  I would also accept \"It is only one person in the world,\n>     who can edit .git/config and be done with it; why bother complicate\n>     the UI for other people\" as a valid argument against it, though ;-).\n>\n> In that \"my private branch gave autority to the branch at my public\n> repository\" case, it is of course easy to re-clone (or \"branch -m\" away\n> and then re-fetch) like everybody else, but then you would lose the reflog\n> from the time before the branch went public, so it is not a solution but a\n> poor workaround.\n\nI'm sorry, but I don't understand why you want to keep the entries in the reflog that were made before you pushed your branch to make it public in this scenario.\n\nEspecially because you are relinquishing the authority to the public repository by wishing to be able to \"track\" it, you can't rewind the branch beyond the point you initially pushed out any more. At that point, wouldn't it make more sense to drop the old reflog data and pretend as if the branch were fetched from the branch from your public repository it now follows, just like everybody else does?\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"107715","messageId":"20090311164030.GA5977@sigill.intra.peff.net","threadId":"18160","inReplyTo":"20090311190207.6117@nanako3.lavabit.com","subject":"Re: setting up tracking on push","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-11T16:40:30Z","receivedAt":"2009-03-11T16:40:30Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 11, 2009 at 07:02:07PM +0900, Nanako Shiraishi wrote:\n\n> I'm sorry, but I don't understand why you want to keep the entries in\n> the reflog that were made before you pushed your branch to make it\n> public in this scenario.\n> \n> Especially because you are relinquishing the authority to the public\n> repository by wishing to be able to \"track\" it, you can't rewind the\n> branch beyond the point you initially pushed out any more. At that\n> point, wouldn't it make more sense to drop the old reflog data and\n> pretend as if the branch were fetched from the branch from your public\n> repository it now follows, just like everybody else does?\n\nThat only means that you cannot rewind back to some spot in the reflog.\nThere is nothing to say that you cannot pull useful ideas from the\nreflog that you thought were failed experiments, and apply them as\nnew commits.\n\n-Peff\n"},{"id":"107738","messageId":"49B82F8F.5050105@xiplink.com","threadId":"18160","inReplyTo":"76718490903102222n23e0e7fdlcee2888333a2b912@mail.gmail.com","subject":"Re: setting up tracking on push","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2009-03-11T21:39:27Z","receivedAt":"2009-03-11T21:39:27Z","isPatch":false,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"Jay Soffian wrote:\n> \n> Actually, for me, I find sometimes I've forgotten to setup tracking,\n> or I've setup tracking and don't want it. I just fire up an editor on\n> .git/config, or use git config, but I would appreciate an easy way to\n> add/remove tracking to a branch after the fact.\n\nI second that -- that's the exact situation I ran into.\n\nEditing .git/config is scary and obscurely documented for new users (who are more likely to forget to set up tracking).  Plus encapsulating this in some porcelain makes it a bit less error-prone.\n\n\t\tM.\n"},{"id":"107750","messageId":"gp9jp7$uc3$1@ger.gmane.org","threadId":"18160","inReplyTo":"buofxhr2vta.fsf@dhlpc061.dev.necel.com","subject":"Re: setting up tracking on push","fromName":"John M. Dlugosz","fromEmail":"ngnr63q02@sneakemail.com","sentAt":"2009-03-12T00:08:03Z","receivedAt":"2009-03-12T00:08:03Z","isPatch":false,"sender":{"key":"ngnr63q02@sneakemail.com","avatar":null},"body":"On a related note, what exactly does \"tracking\" mean?  I know that I can push/pull local \nnames that match up with names on the origin, and that the latter are in the \nremotes/origin subdirectory.  Those are what I think are called \"remote tracking \nbranches\".  Or is that just a part of the whole story?  What is the correct nomenclature?\n\n--John\n"},{"id":"107753","messageId":"76718490903111758l4e4bd29et379e975deb8e99bd@mail.gmail.com","threadId":"18160","inReplyTo":"gp9jp7$uc3$1@ger.gmane.org","subject":"Re: setting up tracking on push","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-12T00:58:59Z","receivedAt":"2009-03-12T00:58:59Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Wed, Mar 11, 2009 at 8:08 PM, John M. Dlugosz\n<ngnr63q02@sneakemail.com> wrote:\n> On a related note, what exactly does \"tracking\" mean?  I know that I can\n> push/pull local names that match up with names on the origin, and that the\n> latter are in the remotes/origin subdirectory.  Those are what I think are\n> called \"remote tracking branches\".  Or is that just a part of the whole\n> story?  What is the correct nomenclature?\n\nhttp://article.gmane.org/gmane.comp.version-control.git/54822/\n\nj.\n"},{"id":"107754","messageId":"7vprgnlf3f.fsf@gitster.siamese.dyndns.org","threadId":"18160","inReplyTo":"76718490903111758l4e4bd29et379e975deb8e99bd@mail.gmail.com","subject":"Re: setting up tracking on push","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-12T01:11:48Z","receivedAt":"2009-03-12T01:11:48Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jay Soffian <jaysoffian@gmail.com> writes:\n\n> On Wed, Mar 11, 2009 at 8:08 PM, John M. Dlugosz\n> <ngnr63q02@sneakemail.com> wrote:\n>> On a related note, what exactly does \"tracking\" mean?  I know that I can\n>> push/pull local names that match up with names on the origin, and that the\n>> latter are in the remotes/origin subdirectory.  Those are what I think are\n>> called \"remote tracking branches\".  Or is that just a part of the whole\n>> story?  What is the correct nomenclature?\n>\n> http://article.gmane.org/gmane.comp.version-control.git/54822/\n\nI do not think the description of remote-tracking in that article is\ncorrect.  We use the word to call remote/origin/<name> that keeps copies\nof what we saw over there when we last observed.\n\nThe way to mark local branches to merge with/rebase onto something else\nby default is --track option to \"git branch\" and \"git checkout -b\", and\nthat is often used to mark them to --track remote-tracking branches but\nthey do not have to --track remote-tracking branches.  They can --track \nlocal branches as well.\n"},{"id":"107755","messageId":"76718490903111814t1ab90a39h9252d0ccf8af05c4@mail.gmail.com","threadId":"18160","inReplyTo":"76718490903111758l4e4bd29et379e975deb8e99bd@mail.gmail.com","subject":"Re: setting up tracking on push","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-12T01:14:15Z","receivedAt":"2009-03-12T01:14:15Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Wed, Mar 11, 2009 at 8:58 PM, Jay Soffian <jaysoffian@gmail.com> wrote:\n\n> http://article.gmane.org/gmane.comp.version-control.git/54822/\n\nLet me summarize that thread as best I can.\n\n- The branches under refs/remotes (those shown by \"git branch -r\") are\nremote tracking branches. This is because they typically match (i.e.\ntrack) the corresponding branch on a remote.\n\n- The branches under refs/heads (those shown by \"git branch\") are your\nlocal branches.\n\n- Local branches can be associated with remote tracking branches in\nthe repo's config (.git/config). This association is done\nautomatically in current git when creating a new local branch based on\na remote tracking branch (e.g, git checkout -b topic origin/master or\ngit branch topic origin/master). (You can use --track and --no-track\nto be explicit about whether or not you want the association to\nhappen.)\n\nThe association itself is simply an entry in the repo's .git/config. e.g.:\n\n[branch \"topic\"]\n        remote = origin\n        merge = refs/heads/master\n\nSo, what does this entry in the .git/config do for you? A number of things:\n\n1) git branch -v, git status, and git checkout will tell you how far\nahead/behind the local branch is from the associated remote tracking\nbranch.\n\n2) git fetch, w/o arguments, will look in the config, find the remote\nfor the currently checked out branch, and update the configured\nremote-tracking branches for said remote. This requires a bit more\nexplanation. In the above example, while topic is checked out, git\nfetch will find that the associated remote is called \"origin\". It will\nthen update origin per its configuration, also in .git/config. e.g.:\n\n[remote \"origin\"]\n        url = git://git.kernel.org/pub/scm/git/git.git\n        fetch = +refs/heads/*:refs/remotes/origin/*\n\nSo that tells git fetch where to fetch from, which remote branches to\nfetch, and where to store those branches locally. In this case, each\nbranch under refs/heads/ on git://git.kernel.org/pub/scm/git/git.git\nwill be fetched and stored locally as refs/remotes/origin/. Locally\nthe branches are called \"remote tracking branches\".\n\n3) git pull, w/o arguments, will run git fetch per above. It then\nknows (in this example) to merge refs/remotes/origin/master into\nrefs/heads/topic. (The value on the \"merge =\" line is arguably\nconfusing because it is relative to where the branch is stored on the\nremote, not where it is stored locally.)\n\nHTH,\n\nj.\n"},{"id":"107756","messageId":"76718490903111816s3da97379x74e4ced2eae96ab2@mail.gmail.com","threadId":"18160","inReplyTo":"7vprgnlf3f.fsf@gitster.siamese.dyndns.org","subject":"Re: setting up tracking on push","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-12T01:16:11Z","receivedAt":"2009-03-12T01:16:11Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Wed, Mar 11, 2009 at 9:11 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> http://article.gmane.org/gmane.comp.version-control.git/54822/\n>\n> I do not think the description of remote-tracking in that article is\n> correct.  We use the word to call remote/origin/<name> that keeps copies\n> of what we saw over there when we last observed.\n>\n> The way to mark local branches to merge with/rebase onto something else\n> by default is --track option to \"git branch\" and \"git checkout -b\", and\n> that is often used to mark them to --track remote-tracking branches but\n> they do not have to --track remote-tracking branches.  They can --track\n> local branches as well.\n\nYes, I noticed this as I re-read the thread. --track and --no-track\nare unfortunately poorly named, but that's ancient history. I've\nsummarized the thread just before you sent this message. I'll update\nmy summary to note this point. :-)\n\nj.\n"},{"id":"107757","messageId":"76718490903111821u1323361m1e251564332c9b06@mail.gmail.com","threadId":"18160","inReplyTo":"76718490903111814t1ab90a39h9252d0ccf8af05c4@mail.gmail.com","subject":"Re: setting up tracking on push","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-12T01:21:03Z","receivedAt":"2009-03-12T01:21:03Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Wed, Mar 11, 2009 at 9:14 PM, Jay Soffian <jaysoffian@gmail.com> wrote:\n> - Local branches can be associated with remote tracking branches in\n> the repo's config (.git/config). This association is done\n> automatically in current git when creating a new local branch based on\n> a remote tracking branch (e.g, git checkout -b topic origin/master or\n> git branch topic origin/master). (You can use --track and --no-track\n> to be explicit about whether or not you want the association to\n> happen.)\n>\n> The association itself is simply an entry in the repo's .git/config. e.g.:\n>\n> [branch \"topic\"]\n>        remote = origin\n>        merge = refs/heads/master\n\nAs Junio points out, a local branch can be associated with another\nlocal branch, not just a remote-tracking branch. In the config, this\nlooks like:\n\n[branch \"topic\"]\n      remote = .\n      merge = refs/heads/master\n\nSo now \"topic\" is associated with *local* branch master, not\nremote-tracking branch master, and this is because \"remote = .\" means\n\"this repo right here\".\n\nBut, when making a new branch based on a local branch via git branch\nand git checkout, adding this association in the config is not the\ndefault. You have to explicitly ask for it with --track.\n\nAlso, the default of whether or not to add the association can itself\nbe changed. See the entry for branch.autosetupmerge (and related\nbranch.autosetuprebase, which I didn't go into) in \"git help config\".\n\nj.\n"},{"id":"108033","messageId":"4845-91917@sneakemail.com","threadId":"18160","inReplyTo":"76718490903111814t1ab90a39h9252d0ccf8af05c4@mail.gmail.com","subject":"Re: setting up tracking on push","fromName":"John M. Dlugosz","fromEmail":"ngnr63q02@sneakemail.com","sentAt":"2009-03-15T03:28:36Z","receivedAt":"2009-03-15T03:28:36Z","isPatch":false,"sender":{"key":"ngnr63q02@sneakemail.com","avatar":null},"body":"Jay Soffian jaysoffian-at-gmail.com |git| wrote:\n> - The branches under refs/remotes (those shown by \"git branch -r\") are\n> remote tracking branches. \n > So that tells git fetch where to fetch from, which remote branches to\n> fetch, and where to store those branches locally. In this case, each\n> branch under refs/heads/ on git://git.kernel.org/pub/scm/git/git.git\n> will be fetched and stored locally as refs/remotes/origin/. Locally\n> the branches are called \"remote tracking branches\".\n>\n>   \n\n\nThings under refs/remotes are remote tracking branches, and local \nbranches (under refs/heads) that automatically updated based on a fetch \n(\"store locally\" means merge or rebase, right?) are also called remote \ntracking branches.\n\nI think that's why some of us are confused.\n\n--John\n"},{"id":"108045","messageId":"76718490903150536r2d3e687ckbcc4e1bdb2d2194d@mail.gmail.com","threadId":"18160","inReplyTo":"4845-91917@sneakemail.com","subject":"Re: setting up tracking on push","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-15T12:36:31Z","receivedAt":"2009-03-15T12:36:31Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Sat, Mar 14, 2009 at 11:28 PM, John M. Dlugosz\n<ngnr63q02@sneakemail.com> wrote:\n\n> Things under refs/remotes are remote tracking branches\n\nYes.\n\n> and local branches\n> (under refs/heads) that automatically updated based on a fetch (\"store\n> locally\" means merge or rebase, right?) are also called remote tracking\n> branches.\n\nNo. The branches under refs/heads are *not* [1] updated by fetch.\n\n- Anything under refs/remotes is a remote tracking branch.\n- Anything under refs/heads is a local branch.\n\nNow, often local branches are based on remote tracking branches, in the\nsense that you created the local branch _from_ the remote tracking\nbranch. So periodically, you will want to update the local branch in\norder to incorporate your local changes with whatever changes have been\nmade in the remote tracking branch. Doing this is a two-step process:\n\n1) You update your remote tracking branches using fetch.\n2) You integrate the changes from the remote tracking branches into your\n   local branches using either merge or rebase.\n\n> I think that's why some of us are confused.\n\nI remember being just as confused, but oddly it seems so clear to me\nnow. I think there is an inflection point where git goes from\n\"confusing\" to \"ah hah, it's ingenious!\" :-)\n\nLet me try to draw a little ascii art:\n\nLocal Repo                                  Remote Repo (origin)\n----------                                  --------------------\nrefs/remotes/origin/master  <-- fetch ---   refs/heads/master\n        |\n(merge or rebase)\n        |\n        v\nrefs/heads/master\n\nAs changes are made to refs/heads/master on the remote repo, the\ncorresponding remote tracking branch on the local repo\n(refs/remotes/origin/master) will fall behind. Performing a fetch in the\nlocal repo updates its refs/remotes/origin/master to match the remote's\nrefs/heads/master. Then either merge or rebase in the local repo, while\nrefs/heads/master is checked out, integrates those changes.\n\nIf no changes have been made locally to refs/heads/master, then the\nmerge operation is a so-called \"fast forward\".\n\nThe confusing part is that there is a switch to \"git checkout\" and \"git\nbranch\" named \"--track\". A better name would have probably been\n\"--follow\". Regardless, this switch [2], configures branch.<name>.remote\nand branch.<name>.merge in the local repo's .git/config. And I mentioned\nin a previous message the reason for having these. [3]\n\n[1] You could of course configure fetch to do whatever you like, but it\n    would be rather unusual to update refs/heads via fetch.\n[2] Which is the default in current git when a local branch is created\n    from a remote tracking branch.\n[3] Namely, 1) branch -v, status, and checkout tell you how far\n    ahead/behind the local branch is from the remote tracking branch;\n    2) pull can be run w/o having to explicitly tell it what to fetch\n    and what to merge.\n\nj.\n"},{"id":"108050","messageId":"7v1vsy8wkp.fsf@gitster.siamese.dyndns.org","threadId":"18160","inReplyTo":"4845-91917@sneakemail.com","subject":"Re: setting up tracking on push","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-15T18:33:58Z","receivedAt":"2009-03-15T18:33:58Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"John M. Dlugosz\" <ngnr63q02@sneakemail.com> writes:\n\n> Jay Soffian jaysoffian-at-gmail.com |git| wrote:\n>> - The branches under refs/remotes (those shown by \"git branch -r\") are\n>> remote tracking branches. So that tells git fetch where to fetch\n>> from, which remote branches to\n>> fetch, and where to store those branches locally. In this case, each\n>> branch under refs/heads/ on git://git.kernel.org/pub/scm/git/git.git\n>> will be fetched and stored locally as refs/remotes/origin/. Locally\n>> the branches are called \"remote tracking branches\".\n>\n> Things under refs/remotes are remote tracking branches, and local\n> branches (under refs/heads) that automatically updated based on a\n> fetch (\"store locally\" means merge or rebase, right?) are also called\n> remote tracking branches.\n>\n> I think that's why some of us are confused.\n\nTrue; the latter wording invites confusion.\n\nWhat fetch updates directly from remote site are called \"remote tracking\nbranches\".  The local branches you intend to keep up to date with respect\nto one remote tracking branch is sometimes said to \"track\" the remote\ntracking branch, but because I find it confusing to use the same verb for\nthis other purpose, I tend to say that local branch (that \"tracks\" the\nother one)\n\n (1) _forked_ from; or\n (2) _builds_ on\n\nthe remote tracking branch, in order to avoid confusion.\n\nHistorically, refs/remotes/ hierarchy did not exist, and \"git clone\"\ncreated these refspecs after cloning from a two branch project:\n\n    refs/heads/master:refs/heads/origin\n    refs/heads/maint:refs/heads/maint\n\nand created a local master starting at 'origin'.\n\nThe expectation was that everybody would work on 'master', occasionally\nreferring to 'maint', and because 'master' is always checked out, avoid \n'fetch' from disturbing it by using a separate local branch 'origin' to\nkeep track of the advance of the other side, while updating 'maint' that\nis not checked out directly.\n\nThis was the layout used in the good old times, and worked well *only* in\nthe most simplistic case.  In reality, people used far more branches and\nworked on branches other than master.\n\nTo fix that, refs/remotes/ hierarchy was introduced, and we started\ntreating the tracking part of master the same way as other branches, i.e.\n\n    refs/heads/*:refs/remotes/origin/*\n\nThe local 'maint' in the old layout was called a remote tracking branch,\ntoo, even though it was local.  These days, if you use the default layout\n\"git clone\" gives you, you can say refs under refs/remotes/ hierarchy are\nall remote tracking branches, and you do not have any remote tracking\nbranches that are local.\n"},{"id":"108061","messageId":"4218-19699@sneakemail.com","threadId":"18160","inReplyTo":"76718490903150536r2d3e687ckbcc4e1bdb2d2194d@mail.gmail.com","subject":"Re: setting up tracking on push","fromName":"John M. Dlugosz","fromEmail":"ngnr63q02@sneakemail.com","sentAt":"2009-03-16T01:07:45Z","receivedAt":"2009-03-16T01:07:45Z","isPatch":false,"sender":{"key":"ngnr63q02@sneakemail.com","avatar":null},"body":"Jay Soffian jaysoffian-at-gmail.com |git| wrote:\n> I remember being just as confused, but oddly it seems so clear to me\n> now. I think there is an inflection point where git goes from\n> \"confusing\" to \"ah hah, it's ingenious!\" :-)\n>\n>   \n\nIn this case, the confusion is with different people posting different \nmeanings for the term, and more generally using the term in different ways.\n"},{"id":"108062","messageId":"76718490903151843x6af7e3d0i211e45d0bb9a05c3@mail.gmail.com","threadId":"18160","inReplyTo":"4218-19699@sneakemail.com","subject":"Re: setting up tracking on push","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-03-16T01:43:27Z","receivedAt":"2009-03-16T01:43:27Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Sun, Mar 15, 2009 at 9:07 PM, John M. Dlugosz\n<ngnr63q02@sneakemail.com> wrote:\n> Jay Soffian jaysoffian-at-gmail.com |git| wrote:\n> In this case, the confusion is with different people posting different\n> meanings for the term, and more generally using the term in different ways.\n\nIn that case I'll stop replying to this thread, I wouldn't want to\ncause any additional confusion. :-)\n\nj.\n"},{"id":"109197","messageId":"m3ocvr2qfx.fsf@localhost.localdomain","threadId":"18160","inReplyTo":"76718490903102115x27a869f2la0d5ca9003bcc95a@mail.gmail.com","subject":"Re: setting up tracking on push","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-03-24T09:58:06Z","receivedAt":"2009-03-24T09:58:06Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Jay Soffian <jaysoffian@gmail.com> writes:\n> On Tue, Mar 10, 2009 at 11:57 PM, Jeff King <peff@peff.net> wrote:\n\n>>> -u w/o --track/--no-track is a usage error.\n>>\n>> Then what is the point of \"-u\"? You said before that it was a new\n>> operation with room for future growth of additional options. Either it\n>> is _just_ for --track, in which case I think you are better to have a\n>> single option representing the notion of \"update the tracking setup\", or\n>> it isn't, in which case it needs to have room for future expansion.\n> \n> For *now*, it is just for --track/--no-track, since I can't think of\n> anything sensible that \"-u\" without --track nor --no-track would do.\n> \n> So it means, update the branch config, but you have to tell it what\n> aspect of the branch config to update.\n> \n> I agree that currently, a single option could do here, but I can't\n> think of a good one. --add-tracking and --delete-tracking? I was\n> trying to re-use the fact that we already have --track and --no-track,\n> but I needed some way to differentiate the mode from \"create a new\n> branch\". Hence -u.\n\nI would suggest '-n' here, as \"git branch\" doesn't do its main\nfunction (with a branch), namely create, delete or modify branch head.\nYour '-u' is all about _not_ updating branch head, but peripheral\ninformation.\n\nBut I do wonder if it is really a good idea...\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"}]}