I have a Git repo that has a lot of commits and separate code, say
/Proj1
I also have another Git repo that has 1 commit in it that is not a common commit,
/Proj2
How can I merge the two repos and have history show up correctly with parent commits? Basically, there aren't any shared commits between the two repos but I want to have one repo that has both sets of code. I'd like for it to look like:
proj2 commit
proj2 commit
proj1 commit (root)
I know that rebase is an option, but not sure if using --onto
replaces the root commit (which it seems to do if I do a fetch from the remote repo and rebase --onto --root master
).
I've tried using git subtrees which initially look like they work, but when I use git-tfs to push my commits up, but I'm getting an error that says
warning: the parent ... does not belong to a TFS tracked branch (not checked in TFS) and will be ignored
and the commits don't actually push up (also likely because it's a subtree).
Edit: I only want to end up with 1 repo (Proj1) but have Proj2's commits come after Proj1's commit on the master branch.
;)
– Hedges--root
option shouldn't be necessary, unless you want to edit the root commit...it's been a while since I've done this sort of thing, so I'll need to double check. Although this would not be a difficult thing to do in Git, however, I don't know how such a change will be received by TFS. – Hedgesgit rebase --onto master --root otherMaster
. In such a case, the root ofotherMaster
is transplanted onto the tip ofmaster
, and assuming that there are no conflicts, its code state will not be altered by the rebase. – Hedges