How to combine two branches from two different repositories in a single repository?

前端 未结 3 1770
失恋的感觉
失恋的感觉 2020-11-27 11:44

The structures of my Git repositories look like this:

A-B-C-D-E-F   # master branch in separate repo1
A-B-C-D-E-G-H # master branch in separate repo2
         


        
3条回答
  •  广开言路
    2020-11-27 12:11

    You can treat another git repository on the same filesystem as a remote repo.

    In the first, do the following:

    git remote add  /path/to/other/repo/.git
    git fetch 
    git branch  /master #optional
    

    Now they're both branches in a single repository. You can switch between them with git checkout, merge with git merge, etc.

提交回复
热议问题