git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Pushing a new branch to a remote and tracking it
@ 2010-07-27 22:12 Bradley Wagner
  2010-07-27 22:35 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Bradley Wagner @ 2010-07-27 22:12 UTC (permalink / raw)
  To: git

Is there a more elegant way to: 1) create a branch, 2) push it to a
remote and 3) continue to track it.

I noticed that:

git branch <branchname> HEAD
git checkout <branchname>
git push origin <branchname>

does not link the local branch to the remote.

I've seen other people do:

git push origin origin:refs/heads/<branchname>
git fetch origin
git branch -r (verify that the branch is there)
git checkout <branchname> -b origin/<branchname>

but it seems kind of the reverse of what I would expect to do. I know
I could also do the first thing and then delete/re-checkout the branch
with tracking.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Pushing a new branch to a remote and tracking it
  2010-07-27 22:12 Pushing a new branch to a remote and tracking it Bradley Wagner
@ 2010-07-27 22:35 ` Andreas Schwab
  2010-07-28  1:20   ` Bradley Wagner
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2010-07-27 22:35 UTC (permalink / raw)
  To: Bradley Wagner; +Cc: git

Bradley Wagner <bradley.wagner@hannonhill.com> writes:

> Is there a more elegant way to: 1) create a branch, 2) push it to a
> remote and 3) continue to track it.

git push --set-upstream (since v1.7.0)

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Pushing a new branch to a remote and tracking it
  2010-07-27 22:35 ` Andreas Schwab
@ 2010-07-28  1:20   ` Bradley Wagner
  0 siblings, 0 replies; 3+ messages in thread
From: Bradley Wagner @ 2010-07-28  1:20 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: git

On Tue, Jul 27, 2010 at 6:35 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Bradley Wagner <bradley.wagner@hannonhill.com> writes:
>
>> Is there a more elegant way to: 1) create a branch, 2) push it to a
>> remote and 3) continue to track it.
>
> git push --set-upstream (since v1.7.0)

Thanks! That's exactly what I was looking for.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-28  1:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-27 22:12 Pushing a new branch to a remote and tracking it Bradley Wagner
2010-07-27 22:35 ` Andreas Schwab
2010-07-28  1:20   ` Bradley Wagner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).