How do I track a branch of another repository on the same machine?

Posted by Daniel Stutzbach on Stack Overflow See other posts from Stack Overflow or by Daniel Stutzbach
Published on 2010-04-06T01:04:15Z Indexed on 2010/04/06 1:13 UTC
Read the original article Hit count: 206

Filed under:

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?

© Stack Overflow or respective owner

Related posts about git