From: Roger Gammans <rgammans@gammascience.co.uk>
To: Steve Keller <keller.steve@gmx.de>, git@vger.kernel.org
Subject: Re: Merging two Git-Repositories
Date: Tue, 17 Dec 2019 10:02:22 +0000 [thread overview]
Message-ID: <fd4bd9c49d7d4daf4275b19a9b5f7478f2e4e145.camel@gammascience.co.uk> (raw)
In-Reply-To: <trinity-c6dbf360-5abe-43df-8428-85514195a7a6-1576574916643@3c-app-gmx-bs62>
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@gammascience.co.uk>
next prev parent reply other threads:[~2019-12-17 10:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-17 9:28 Merging two Git-Repositories Steve Keller
2019-12-17 10:02 ` Roger Gammans [this message]
2019-12-17 11:03 ` Jared Tobin
2019-12-17 20:13 ` Stephan Beyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fd4bd9c49d7d4daf4275b19a9b5f7478f2e4e145.camel@gammascience.co.uk \
--to=rgammans@gammascience.co.uk \
--cc=git@vger.kernel.org \
--cc=keller.steve@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).