Merging separate git repos into one

Home / Uncategorized / Merging separate git repos into one

Question:
I can use a hand coming up with the right way to do this. I’ve got a TFVC style repository in which there are several branches. I want to move the entire thing over to git. I’m using git tfs (https://github.com/git-tfs/git-tfs) to export the TFVC stuff to local git repos, but the history is too complex and therefore I cannot export all of the branches at once. That in itself is not a problem since we also want to migrate to a different branching strategy whilst at it.

What the plugin does allow me is to export each individual branch with a subset of its history to a local git repo. So I end up with local repos for "master" and one for every release that has been stored in TFVC.

Now I want to commit these into a single new git repo. The master should go into a new master branch and for each release I want to create a branch "releases/release-xyz". How can I commit all of the code + history from each local repo into the right branch in the new repo? I found bits and pieces adding a remote and pushing each branch, but I want to make sure that I’m not forgetting anything here. I don’t care about the merging history between the branches, as long as the exported history for each branch itself is intact.

So, exported structure:folder A (master)
folder B (release-abc)
folder C (release-xyz)

And target structure:repo/master
repo/releases/release-abc
repo/releases/release-xyz


Answer:

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *