Re: Creating new remote branch in git?

Bruce Momjian <bruce@momjian.us>

From: Bruce Momjian <bruce@momjian.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Greg Smith <greg@2ndQuadrant.com>, pgsql-hackers@postgresql.org
Date: 2011-06-12T15:45:54Z
Lists: pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > Uh, I think someone needs to add this to our wiki:
> 
> I did.

I saw your commit that mentioned how to create a new branch.  My problem
was with using workdir:

	http://wiki.postgresql.org/wiki/Committing_with_Git#Committing_Using_a_Single_Clone_and_multiple_workdirs

I had to use:

        pggit config branch.REL9_1_STABLE.remote origin
        pggit config branch.REL9_1_STABLE.merge refs/heads/REL9_1_STABLE

or I get errors like this during 'pull':

	$ git-new-workdir postgresql/.git/ 8.2
	Checking out files: 100% (3851/3851), done.

	$ cd 8.2

	$ git checkout -b REL8_2_STABLE origin/REL8_2_STABLE
	Checking out files: 100% (3908/3908), done.
	error: Not tracking: ambiguous information for ref refs/remotes/origin/REL8_2_STABLE
	Switched to a new branch 'REL8_2_STABLE'

	$ git pull
	You asked me to pull without telling me which branch you
	want to merge with, and 'branch.REL8_2_STABLE.merge' in
	your configuration file does not tell me, either. Please
	specify which branch you want to use on the command line and
	try again (e.g. 'git pull <repository> <refspec>').
	See git-pull(1) for details.
	
	If you often merge with the same branch, you may want to
	use something like the following in your configuration file:
	
	    [branch "REL8_2_STABLE"]
	    remote = <nickname>
	    merge = <remote-ref>
	
	    [remote "<nickname>"]
	    url = <url>
	    fetch = <refspec>
	
	See git-config(1) for details.

(Is that "error: Not tracking: ambiguous information" error harmless?)

Once I execute this:

	$  git config branch.REL8_2_STABLE.remote origin
	$  git config branch.REL8_2_STABLE.merge refs/heads/REL8_2_STABLE

'pull' then works:

	$ git pull
	Already up-to-date.

So my point is I don't think we document the need to either update
.git/config or run those commands.  The pull error message suggests
updating .git/config, but ideally we should tell users how to set this
up.  

Editing the config file was mentioned in this email thread:

	http://archives.postgresql.org/pgsql-hackers/2011-06/msg00860.php

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +