Jump to content

How do I combine repositories without losing history?

Recommended Posts

I want to merge two repositories (or more) into a single repository without losing history of either repository, but have the full history of both available in the new repo.

I have project1 and project2, each in their own repo (repo1 and repo2). Each project’s folder structure is set up the same—i.e. there’s a “/src” folder, a “/build” folder, etc in each. I want to bring each project (along with history) into a new repo where the /main will eventually (after some tweaking) have a folder structure such as:


So, in Plastic I imagine doing this as follows: I’d like to have a new repo with a /main branch. And then create two child branches off that (called say “/main/repo1” and “/main/repo2”). And then on each of those child branches import the “/main” branch of each of the two repositories. This would let me have the full history of both on their own branches and then I could merge those two branches together after making changes to the folder structure in each so I could merge as above.

However I can’t figure out how to do this in plastic. Attempting to “pull remote branch” or replicate a repo doesn’t work as desired in this case (I can’t sync a src repo to a specific branch in a target repo, at least not I am aware of).

So first question, is there a way to synchronize an entire source repository to a specific child branch in a destination repository that I want to map as the main for the source repo? If so, how do I do that?

Second question, if there’s no way to do that, then is there any other way to do what I want?

I’m sure others have wanted to combine or split repositories over the years, how have you preserved history in that case?

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...