Merging two remote repositories in Git

I would recommend:

  • cloning yourRemoteRepo (that way, you can easily pull/push from that repo)
  • adding mainstreamRepo as a remote and fetch its branch, then track the one which interest you

    git clone git://yourRemoteRepo
    git remote add mainStreamRepo http://mainStreamRepo
    git fetch mainStreamRepo
    git checkout -b mainStreamMaster mainStreamRepo/master
    git checkout master
    

From there, you can

  • merge mainStreamMaster to your master,
  • or rebase your master on top of mainStreamMaster (in order to integrate the full history of mainStreamMaster into your master branch)
  • then make some evolutions to master (or to a topic-specific branch) that you can push to yourRemoteRepo.

Leave a Comment