My situation is that I have two Git repositories that I need to merge into a single repository (there are actually more repos, but I can start with two).
The two rep
The solution turned out to be much more involved than I had hoped for. It involves manipulating and combining the output of two (or more) git fast-export
streams, and importing them into a new repository using git fast-import
.
In short, a new fast-import
stream is generated by traversing two input streams, and switching back-and-forth between them based on a date-sorted log from the main branches.
I have implemented the solution in a Python script called join-git-repos.py
, that I put in a GitHub repository here.