0

I have a repo A with a branch a and repo B with branch b.

I would like to make the branch B:b track A:a (with a local copy of either of these branches if necessary). Is that possible?

1 Answer 1

2

In the local B repo:

  1. First setup a remote to A repositoy named upstream (or any other name you prefer):

    git remote add upstream <A remote address> 
  2. Make branch b track a:

    check to see if you have a local b branch:

    git branch --list 
    • if you already have got a local b:

      git branch -u upstream/a b 
    • if you does not have a local b:

      git checkout -b b upstream/a 

Now in the b Branch of B repo if you do git fetch, git pull and git push it will sync against A:a and for syncing against original B:b run git pull origin b for example to pull.

Sign up to request clarification or add additional context in comments.

Comments