Re: Creating new remote branch in git?

From: Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Joe Abbate <jma(at)freedomcircle(dot)com>, Alex Hunsaker <badalex(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Creating new remote branch in git?
Date: 2011-06-10 11:34:27
Message-ID: BANLkTi=HPmSQtqZ=52O=OPKV2wBbFu7+5w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 10, 2011 at 12:40 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Joe Abbate <jma(at)freedomcircle(dot)com> writes:
> > No, it doesn't trash anything. The branch is just an additional
> > "pointer" to 'master' (at that point in time). I recommend taking a
> > look at this:
>
> > http://progit.org/book/ch3-5.html
>
> Yes, I was reading exactly that before posting. It talks about pushing
> a branch you've created locally, and it talks about what happens when
> others pull that down, and it's about as clear as mud w/r/t how the
> original pusher sees the remote branch. What I want is to end up
> with my local branch tracking the remote branch in the same way as if
> I'd not been the branch creator. Preferably without having to do
> anything as ugly as delete the branch, or re-clone, or manually hack
> config files. This has got to be a use case that the git authors
> have heard of before...
>

I have done this quite a few times on GitHub and has never barfed on me in
any surprising way:

# make sure local master is up-to-date with origin/master, and then do
git checkout master
git checkout -b new_branch
git push origin new_branch

From here on I work as if that new_branch was handed to me from the origin.
I believe this also takes care of setting up the .git/config file properly.

Just in case it is needed: to delete a branch on remote, just do

git push origin :new_branch

It will keep your local branch (if you have it), but will nuke the remote
branch.

Regards,

PS: Play a bit on GitHub
--
Gurjeet Singh
EnterpriseDB Corporation
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2011-06-10 13:03:04 Re: Feature idea: standard_quoting_identifiers property
Previous Message Dimitri Fontaine 2011-06-10 11:21:13 Re: Core Extensions relocation