# config for merging master to test branch

5 messages from 2009-12-28 to 2009-12-29. Participants: Daniel Convissor, Junio C Hamano.
Thread: https://gitlist.dev/t/22044

## Daniel Convissor, 2009-12-28 23:38

Subject: config for merging master to test branch
Message-ID: <20091228233838.GA28052@panix.com>
URL: https://gitlist.dev/e/20091228233838.GA28052%40panix.com

```
Hello:

Here's my workflow...

testing directory (test branch)
    [set origin to server repository]
    git pull
    git branch test
    git checkout test
    [edit settings files]
    git commit ...

working directory (master branch)
    [set origin to server repository]
    [make changes]
    git commit ...
    git push origin master

Now, here's the question.  I want to go back into the testing directory 
and do a "git pull" and have the changes from master automatically merged 
into my test branch in one step, without having to do an explicit set of 
checkouts and merges.  I get the impression there are configuration 
settings that allow such to be done.  Is my impression correct?  If so, 
what are the explicit configuration commands, please?  Or is there some 
command other than "pull" I should be using to do this?

Thanks,

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409

```

## Daniel Convissor, 2009-12-29 16:43

Subject: Re: config for merging master to test branch
Message-ID: <20091229164343.GA17546@panix.com>
URL: https://gitlist.dev/e/20091229164343.GA17546%40panix.com
In-Reply-To: <20091228233838.GA28052@panix.com>

```
Hello Again Folks:

On Mon, Dec 28, 2009 at 06:38:39PM -0500, Daniel Convissor wrote:
> 
> Now, here's the question.  I want to go back into the testing directory 
> and do a "git pull" and have the changes from master automatically merged 
> into my test branch in one step, without having to do an explicit set of 
> checkouts and merges.

I found this is possible by being in the "test" checkout and calling
"git pull origin master".  Is this the best way to do it?

Thanks,

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409

```

## Junio C Hamano, 2009-12-29 16:53

Subject: Re: config for merging master to test branch
Message-ID: <7vvdfphgbu.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vvdfphgbu.fsf%40alter.siamese.dyndns.org
In-Reply-To: <20091229164343.GA17546@panix.com>

```
Daniel Convissor <danielc@analysisandsolutions.com> writes:

> On Mon, Dec 28, 2009 at 06:38:39PM -0500, Daniel Convissor wrote:
>> 
>> Now, here's the question.  I want to go back into the testing directory 
>> and do a "git pull" and have the changes from master automatically merged 
>> into my test branch in one step, without having to do an explicit set of 
>> checkouts and merges.
>
> I found this is possible by being in the "test" checkout and calling
> "git pull origin master".  Is this the best way to do it?

Good.  That is how it was designed to be used ;-)

If you feel lazy and want to omit typing " origin master", you could add a
few configuration items in your .git/config in the test repository.

    [branch "test"]
        remote = origin
        merge = refs/heads/master

That configures git in such a way that...

    When on branch "test", "pull" and "fetch" by default interact with the
    "origin" repository, and "pull" integrates what was found on the
    'master' branch from that remote into your history.

```

## Daniel Convissor, 2009-12-29 17:56

Subject: Re: config for merging master to test branch
Message-ID: <20091229175607.GA3683@panix.com>
URL: https://gitlist.dev/e/20091229175607.GA3683%40panix.com
In-Reply-To: <7vvdfphgbu.fsf@alter.siamese.dyndns.org>

```
Hi Junio:

> Good.  That is how it was designed to be used ;-)

Thanks for the reassurance.


>     [branch "test"]
>         remote = origin
>         merge = refs/heads/master
> 
>     When on branch "test", "pull" and "fetch" by default interact with the
>     "origin" repository, and "pull" integrates what was found on the
>     'master' branch from that remote into your history.

Excellent.  Initially, I wasn't sure what the following commands did:

   git config branch.test.remote origin
   git config branch.test.merge refs/heads/master

Between further reading and your explanation I now understand it better. 
"refs/heads/master" refers items displayed by "git show-ref".

So what is "refs/remotes/origin/master", please?

Thanks,

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409

```

## Junio C Hamano, 2009-12-29 18:32

Subject: Re: config for merging master to test branch
Message-ID: <7vskatd418.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vskatd418.fsf%40alter.siamese.dyndns.org
In-Reply-To: <20091229175607.GA3683@panix.com>

```
Daniel Convissor <danielc@analysisandsolutions.com> writes:

> Excellent.  Initially, I wasn't sure what the following commands did:
>
>    git config branch.test.remote origin
>    git config branch.test.merge refs/heads/master
>
> Between further reading and your explanation I now understand it better. 
> "refs/heads/master" refers items displayed by "git show-ref".

Not quite.  refs/heads/master there refers to the _local_ master branch,
but it is _local_ with respect to the origin repository, not your
repository.  "git show-ref" is about showing refs in _your_ repository.

> So what is "refs/remotes/origin/master", please?

    http://gitster.livejournal.com/30313.html

If you read Japanese, you may also want to read Ch.13 of my book ;-)

The refs/remotes/ hierarchy is used to store a copy of the branch tips
fetched from the named remotes (like "origin").

```
