Skip to contentSkip to conversation

config for merging master to test branch

DISCUSSION Daniel Convissor 2 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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

Signature · 4 lines
 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
#1 lore raw

Hello Again Folks:

Quoted 5 lines · Daniel Convissor

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

Signature · 4 lines
 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
#2 lore raw
Quoted 9 lines · Daniel Convissor
Quoted 5 lines · Daniel Convissor

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.

#3 lore raw

Hi Junio:

Quoted 1 line

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

Thanks for the reassurance.

Quoted 7 lines

[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

Signature · 4 lines
 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
#4 lore raw
Quoted 7 lines · Daniel Convissor

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.

Quoted 1 line

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").