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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

31,866 views 26 12
Join discussion

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