{"thread":{"id":"26529","subject":"set-upstream for existing branch...?","startedAt":"2011-02-17T05:19:11Z","lastAt":"2011-02-17T09:41:06Z","messageCount":8,"participants":["Miles Bader","Jay Soffian","Michael J Gruber","knittl"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"161378","messageId":"buoei77xmpc.fsf@dhlpc061.dev.necel.com","threadId":"26529","inReplyTo":null,"subject":"set-upstream for existing branch...?","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2011-02-17T05:19:11Z","receivedAt":"2011-02-17T05:19:11Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"Is there a convenient, intuitive, way to set (or change) @{upstream} for\nthe current branch, without doing anything else...?\n\nThanks,\n\n-Miles\n\n-- \nRun away!  Run away!\n"},{"id":"161382","messageId":"AANLkTikqj8NjLwR647E1tHUuDO=OitUJ1dm5Fs7gtXXt@mail.gmail.com","threadId":"26529","inReplyTo":"buoei77xmpc.fsf@dhlpc061.dev.necel.com","subject":"Re: set-upstream for existing branch...?","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2011-02-17T07:08:55Z","receivedAt":"2011-02-17T07:08:55Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Thu, Feb 17, 2011 at 12:19 AM, Miles Bader <miles@gnu.org> wrote:\n> Is there a convenient, intuitive, way to set (or change) @{upstream} for\n> the current branch, without doing anything else...?\n\n$ git branch <current_branch> --set-upstream <new_upstream>\n\nBut note that this is deceptive: what's important is the relative\npositions of <current_branch> and <new_upstream> on the command-line,\nand they must be in that order. It doesn't (currently) matter where\nyou place the --set-upstream.\n\nI've got it on my todo list to make --set-upstream take <new_upstream>\nas its argument so that you can just say:\n\n$ git branch --set-upstream <new_upstream>\n\nj.\n"},{"id":"161384","messageId":"buo8vxfxhhy.fsf@dhlpc061.dev.necel.com","threadId":"26529","inReplyTo":"AANLkTikqj8NjLwR647E1tHUuDO=OitUJ1dm5Fs7gtXXt@mail.gmail.com","subject":"Re: set-upstream for existing branch...?","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2011-02-17T07:11:37Z","receivedAt":"2011-02-17T07:11:37Z","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> On Thu, Feb 17, 2011 at 12:19 AM, Miles Bader <miles@gnu.org> wrote:\n>> Is there a convenient, intuitive, way to set (or change) @{upstream} for\n>> the current branch, without doing anything else...?\n>\n> $ git branch <current_branch> --set-upstream <new_upstream>\n>\n> But note that this is deceptive: what's important is the relative\n> positions of <current_branch> and <new_upstream> on the command-line,\n> and they must be in that order. It doesn't (currently) matter where\n> you place the --set-upstream.\n>\n> I've got it on my todo list to make --set-upstream take <new_upstream>\n> as its argument so that you can just say:\n>\n> $ git branch --set-upstream <new_upstream>\n\nThanks, the latter sounds nice, but for now the former is good for an alias...\n\n-miles\n\n-- \nDictionary, n.  A malevolent literary device for cramping the growth of\na language and making it hard and inelastic. This dictionary, however,\nis a most useful work.\n"},{"id":"161385","messageId":"AANLkTim6HDCaeTDuEtK+3niKKoz6A3KA=m=UCr4DaY-V@mail.gmail.com","threadId":"26529","inReplyTo":"buo8vxfxhhy.fsf@dhlpc061.dev.necel.com","subject":"Re: set-upstream for existing branch...?","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2011-02-17T07:24:46Z","receivedAt":"2011-02-17T07:24:46Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"Hmm, on a related note, is there an obvious way to _show_ the current\nbranch's upstream...?\n\n[I mean, which just prints out \"origin/master\" or whatever...]\n\nThanks,\n\n-miles\n\n-- \nCat is power.  Cat is peace.\n"},{"id":"161386","messageId":"AANLkTi=GPeo9Xr2taF6bsTF554SguDKGHo_S4P62xyxX@mail.gmail.com","threadId":"26529","inReplyTo":"AANLkTim6HDCaeTDuEtK+3niKKoz6A3KA=m=UCr4DaY-V@mail.gmail.com","subject":"Re: set-upstream for existing branch...?","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2011-02-17T07:45:07Z","receivedAt":"2011-02-17T07:45:07Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Thu, Feb 17, 2011 at 2:24 AM, Miles Bader <miles@gnu.org> wrote:\n> Hmm, on a related note, is there an obvious way to _show_ the current\n> branch's upstream...?\n>\n> [I mean, which just prints out \"origin/master\" or whatever...]\n\ngit rev-parse --abbrev-ref @{u}\n\nj.\n"},{"id":"161390","messageId":"4D5CDB01.9070502@drmicha.warpmail.net","threadId":"26529","inReplyTo":"AANLkTim6HDCaeTDuEtK+3niKKoz6A3KA=m=UCr4DaY-V@mail.gmail.com","subject":"Re: set-upstream for existing branch...?","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-02-17T08:23:29Z","receivedAt":"2011-02-17T08:23:29Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Miles Bader venit, vidit, dixit 17.02.2011 08:24:\n> Hmm, on a related note, is there an obvious way to _show_ the current\n> branch's upstream...?\n> \n> [I mean, which just prints out \"origin/master\" or whatever...]\n> \n> Thanks,\n> \n> -miles\n> \n\ngit for-each-ref --format=\"%(upstream)\" $(git symbolic-ref HEAD)\n\nI can't come up with a better way of expanding @{u} without resolving\nthe resulting refname to a SHA1. You could do\n\ngit name-rev @{u}\n\nor similar with \"describe\", but that's really backwards - it first\nexpands @{u} to a refname, then to a SHA1, and then tries to describe\nthat SHA1 by a refname...\n\nBTW: Please don't change \"--set-upstream\" light-heartedly and isolated\nfrom other stuff. We need more consistency wrt. subcommands vs. options\nvs. options taking parameters. So an incompatible change should be part\nof a bigger picture. This requires some research about our current\nusage, pitfalls, and the best way forward (breaking as little as\npossible and achieving as much as possible).\n\nMichael\n"},{"id":"161395","messageId":"AANLkTimPYkEczv=suCr02rVb3OSg_h9o88_5CEmonPTR@mail.gmail.com","threadId":"26529","inReplyTo":"4D5CDB01.9070502@drmicha.warpmail.net","subject":"Re: set-upstream for existing branch...?","fromName":"knittl","fromEmail":"knittl89@googlemail.com","sentAt":"2011-02-17T09:25:32Z","receivedAt":"2011-02-17T09:25:32Z","isPatch":false,"sender":{"key":"knittl89@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/2149217?v=4"},"body":"On Thu, Feb 17, 2011 at 9:23 AM, Michael J Gruber\n<git@drmicha.warpmail.net> wrote:\n> Miles Bader venit, vidit, dixit 17.02.2011 08:24:\n>> Hmm, on a related note, is there an obvious way to _show_ the current\n>> branch's upstream...?\n>>\n>> [I mean, which just prints out \"origin/master\" or whatever...]\n>>\n>> Thanks,\n>>\n>> -miles\n>>\n>\n> git for-each-ref --format=\"%(upstream)\" $(git symbolic-ref HEAD)\n>\n> I can't come up with a better way of expanding @{u} without resolving\n> the resulting refname to a SHA1. You could do\n\nwhat about\n\n    git branch -vv\n\nit will show all local branches with their upstream plus behind/ahead numbers\n\ncheers,\ndaniel\n\n\n-- \ntyped with http://neo-layout.org\nmyFtPhp -- visit http://myftphp.sf.net -- v. 0.4.7 released!\n"},{"id":"161396","messageId":"4D5CED32.3030507@drmicha.warpmail.net","threadId":"26529","inReplyTo":"AANLkTimPYkEczv=suCr02rVb3OSg_h9o88_5CEmonPTR@mail.gmail.com","subject":"Re: set-upstream for existing branch...?","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-02-17T09:41:06Z","receivedAt":"2011-02-17T09:41:06Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"knittl venit, vidit, dixit 17.02.2011 10:25:\n> On Thu, Feb 17, 2011 at 9:23 AM, Michael J Gruber\n> <git@drmicha.warpmail.net> wrote:\n>> Miles Bader venit, vidit, dixit 17.02.2011 08:24:\n>>> Hmm, on a related note, is there an obvious way to _show_ the current\n>>> branch's upstream...?\n>>>\n>>> [I mean, which just prints out \"origin/master\" or whatever...]\n>>>\n>>> Thanks,\n>>>\n>>> -miles\n>>>\n>>\n>> git for-each-ref --format=\"%(upstream)\" $(git symbolic-ref HEAD)\n>>\n>> I can't come up with a better way of expanding @{u} without resolving\n>> the resulting refname to a SHA1. You could do\n> \n> what about\n> \n>     git branch -vv\n> \n> it will show all local branches with their upstream plus behind/ahead numbers\n\nThat's a very nice and useful output, but my impression was that Miles\nwas more interested in one branch (the current one), and I think Jay\ngave the most direct solution. While it does go through the\nresolve-describe-circle (compared to for-each-ref) it should still be\nefficient.\n\nMichael\n"}]}