{"thread":{"id":"24543","subject":"Pushing a new branch to a remote and tracking it","startedAt":"2010-07-27T22:12:09Z","lastAt":"2010-07-28T01:20:31Z","messageCount":3,"participants":["Bradley Wagner","Andreas Schwab"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"146544","messageId":"AANLkTikxmhndNqGDpwfBm41OuaPvnB=2xqp6gkYOTQiF@mail.gmail.com","threadId":"24543","inReplyTo":null,"subject":"Pushing a new branch to a remote and tracking it","fromName":"Bradley Wagner","fromEmail":"bradley.wagner@hannonhill.com","sentAt":"2010-07-27T22:12:09Z","receivedAt":"2010-07-27T22:12:09Z","isPatch":false,"sender":{"key":"bradley.wagner@hannonhill.com","avatar":"https://gravatar.com/avatar/8304e5020b13d5f8102220fae2f5dd607a2e114dbe62bbd92c1ab38fe0b69fdb?d=mp&s=160"},"body":"Is there a more elegant way to: 1) create a branch, 2) push it to a\nremote and 3) continue to track it.\n\nI noticed that:\n\ngit branch <branchname> HEAD\ngit checkout <branchname>\ngit push origin <branchname>\n\ndoes not link the local branch to the remote.\n\nI've seen other people do:\n\ngit push origin origin:refs/heads/<branchname>\ngit fetch origin\ngit branch -r (verify that the branch is there)\ngit checkout <branchname> -b origin/<branchname>\n\nbut it seems kind of the reverse of what I would expect to do. I know\nI could also do the first thing and then delete/re-checkout the branch\nwith tracking.\n"},{"id":"146548","messageId":"m26300o8nm.fsf@igel.home","threadId":"24543","inReplyTo":"AANLkTikxmhndNqGDpwfBm41OuaPvnB=2xqp6gkYOTQiF@mail.gmail.com","subject":"Re: Pushing a new branch to a remote and tracking it","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2010-07-27T22:35:25Z","receivedAt":"2010-07-27T22:35:25Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Bradley Wagner <bradley.wagner@hannonhill.com> writes:\n\n> Is there a more elegant way to: 1) create a branch, 2) push it to a\n> remote and 3) continue to track it.\n\ngit push --set-upstream (since v1.7.0)\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"146562","messageId":"AANLkTikatSEN1TpZ3SrEVcSOUo+tg=LpUc9d76o3dPXU@mail.gmail.com","threadId":"24543","inReplyTo":"m26300o8nm.fsf@igel.home","subject":"Re: Pushing a new branch to a remote and tracking it","fromName":"Bradley Wagner","fromEmail":"bradley.wagner@hannonhill.com","sentAt":"2010-07-28T01:20:31Z","receivedAt":"2010-07-28T01:20:31Z","isPatch":false,"sender":{"key":"bradley.wagner@hannonhill.com","avatar":"https://gravatar.com/avatar/8304e5020b13d5f8102220fae2f5dd607a2e114dbe62bbd92c1ab38fe0b69fdb?d=mp&s=160"},"body":"On Tue, Jul 27, 2010 at 6:35 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:\n> Bradley Wagner <bradley.wagner@hannonhill.com> writes:\n>\n>> Is there a more elegant way to: 1) create a branch, 2) push it to a\n>> remote and 3) continue to track it.\n>\n> git push --set-upstream (since v1.7.0)\n\nThanks! That's exactly what I was looking for.\n"}]}