tags:

views:

43

answers:

1

I have two private repositories on one machine. Let's call them repo-A and repo-B, which are the directories ~/repo-A and ~/repo-B, respectively. repo-A has two relevant branches: master and live. I'd like to set up repo-B to track repo-A's live branch, so that git pull will pull any updates from repo-A's live branch into repo-B's master branch. Right now, I have the following in repo-B's .git/config:

[remote "origin"]
        url = /home/stutzbach/repo-A/
        fetch = +refs/heads/live:refs/remotes/origin/live
[branch "master"]
        remote = origin
        merge = refs/heads/master

However, when I run git pull, it seems to pull from repo-A's master branch. Obviously, I don't have it set up right. What's the right way?

+2  A: 

You've pasted exactly the bit of the config that's causing that:

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

That's telling it to merge (which is part of pull) from the master branch of origin. Change it to refs/heads/live and you'll have what you want.

Jefromi