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

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

In the first, do the following:

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

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

Leave a Comment