git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephan Beyer <s-beyer@gmx.net>
To: Steve Keller <keller.steve@gmx.de>, git@vger.kernel.org
Subject: Re: Merging two Git-Repositories
Date: Tue, 17 Dec 2019 21:13:35 +0100	[thread overview]
Message-ID: <a909ac32-c94a-fb17-ca4d-13e6ea42cc34@gmx.net> (raw)
In-Reply-To: <trinity-c6dbf360-5abe-43df-8428-85514195a7a6-1576574916643@3c-app-gmx-bs62>

On 12/17/19 10:28 AM, 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.

If I get you right, you want a simple merge of two branches with no
common ancestors. Here's a line-by-line sh example with project A in
directory A and project B in directory B, and B will be merged into a
subdirectory "project-b" in A:

  # change to B's directory
  cd B

  # create the subdirectory where B's files will be in A
  mkdir project-b

  # move all files into project-b
  git mv -k * project-b

  # probably check if this worked for you
  ls
  git status

  # commit
  git commit -m "Move all files into subdirectory for inclusion into A"

  # change to A's directory
  cd ../A

  # fetch and merge B into A
  git pull --no-rebase --allow-unrelated-histories ../B
  # ... change commit message to something more meaningful ...

That's it.

If B is public you might want to replace its last commit by some commit
that adds a note that further development is going on in A.

Stephan

      parent reply	other threads:[~2019-12-17 20:13 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
2019-12-17 11:03 ` Jared Tobin
2019-12-17 20:13 ` Stephan Beyer [this message]

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=a909ac32-c94a-fb17-ca4d-13e6ea42cc34@gmx.net \
    --to=s-beyer@gmx.net \
    --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).