How to merge two Git repositories into one?

Michał Jazłowiecki March 17, 2013

I have two Git repositories, say devel and history which contain source code of the same product:

devel starts (in development timeline, not in commit history) somewhere (I know exactly where) in history (i.e. I know the exact source code snapshot used to create the initial commit in devel).

I would like to merge those two Git repositories into one, which should contain all the commits from history (i.e. source code snapshots) until the first commit to devel and then continue with all the commits from devel. The remaining commits from history may be ignored or moved to a separate branch.

Is it possible? Or maybe I should've imported all the source code snapshots not to a separate Git repository (it's not a big deal to recreate local Git history)?

Kind regards,

1 answer

1 vote
aMarcus
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 6, 2013

Hi Michał

There was a similar issue asked recently here: https://answers.atlassian.com/questions/196564/where-do-i-put-the-files-above-the-trunk. I found this blog post which seems to explain in a lot of great detail how to graft two repositroies together: http://ben.straubnet.net/post/939181602/git-grafting-repositories

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events