How to combine two separate unrelated Git repositories into one with single history timeline
I think you do it like this:
- git remote add [repo b]
- git fetch//get the repo b into repo a
- due to you want to keep the history like this: A0-A1-B1-B0-D1-C0-D0-E0-F0-G0-E1-H(from repo B)-HEAD (new repo A) you can first select the A0 as a start point, after that, use git cherry-pick one by one.
Hope this is useful for you.
Br, Tim
I did something similar (merge history from B into A) like this:
- go to your repo A
git fetch <ref to your repo B> master:new-branch-on-A
(so, you have copied master branch of B into a new branch 'new-branch-on-A' into your repo A.git checkout new-branch-on-A
git rebase master
(you rebase the new-branch-on-A with the master branch)- resolve conflicts if there are any
git checkout master
git merge new-branch-on-A
git branch -d new-branch-on-A
- Done :), your histories are merged. I think all commits from A are before commit from B in the new history (
git rebase -i
is your friend if needed).