Re: Merging two Git-Repositories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2019-12-17 at 10:28 +0100, Steve Keller wrote:
> Is it possible to merge one Git-Repository into another?  I have
> developed two independent repositories A and B, and now I find that
> B should be part of A in new sub-directory, e.g. A/B.  I want to
> move B into A while keeping the whole development history of B.
> 
> How can I do that?

It is possible bit isn't straightforward, at least not if you want to
interleave the commits.

If you don't want to interleave the commits, just rename everything (*)
in B to B/*' and merge the repo with A's repo. Then you will have a the
structure you want going forward, all the history together; but if you
check out a historic commit you will have to decide to check out on the
'A' or 'B' branches.

If you do want to interleave the comits the best  found was  ( 
https://metacpan.org/pod/distribution/Git-FastExport/script/git-stitch-repo
to merge the repos. (from https://github.com/book/Git-FastExport/ )

I've got some updates (
https://github.com/rgammans/Git-FastExport/tree/hintfiles ) to it when
I did some work on this a couple of years ago but the it looks like the
upstream has improved a little since then. My changes allow you to try
to give it hints in case in make mistakes, on choosing the correct
parent for a commit. The whole system worked pretty well except where
there were a lot a diverging/remerging branches.

My process was to write a shell script to actually drive the process,
and tweak the script to improve the results iteratively.

Hope this helps a little.

-- 
Roger Gammans <rgammans@xxxxxxxxxxxxxxxxxx>




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux