There is a (and it seems not particularly rare) need sometimes to combine (I’ll avoid using the term “merge” for this) two repositories into a single repository so that we can then delete the original two and do all work on the new combined repository.
This is discussed for example in this blogpost
You’ll see a question I just asked on that blog and I’m repeating that question here:
This is an interesting post and I have a question, does your solution cover the most genera case? Here’s what I mean.
I have repo_a and repo_b.
_ repo_a has branches master, gui_project and api_project branches_
_ repo_b has branches master, mem_project and api_project branches._
In this scenario api_project has the same name in each repo because it is the same project, some code in repo_a and some in repo_b.
I want to combine these and end up with repo_c that has 4 branches:
master, gui_project, mem_project and api_project.
_master contains all commits from master in repo_a and repo_b _
_api_project contains all commits from api_project in repo_a and repo_b _
_mem_project contains all commits from repo_b _
_gui_project contains all commits from repo_a _
The repos are completely different, their folder structure and so on are unrelated so no folder/path/file hieracrchy appears in more than one repo, that is there is no code/files that is in each repo.
This is my challenge, in repos where we have a lot of branches some unique to each repo and some with the same name in each repo because the work on them pertains to the same project.
Now I know that GitHub doesn’t provide such a capability (be great if it did as this need often arises from time to time as projects or organizations grow and mature) but has anyone done this, in the general case that I outline above?
In reality there a quite a lot more branches than just four, but this should be academic if we have a general solution.
I want to attempt this but also want to gather as much input from others and git gurus before I actually begin, I’d hate to spend an hour or two then hit some roadblock simply because of a lack of due dilligence.