How to merge two Git repositories into one?

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

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
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

436 views 6 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you