git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: David Aguilar <davvid@gmail.com>
To: "Dirk Süsserott" <newsletter@dirk.my1.cc>
Cc: Tomas Carnecky <tomas.carnecky@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: Merging/joining two repos (repo2 should be a subdirectory of repo1)
Date: Sun, 30 Sep 2012 13:44:11 -0700	[thread overview]
Message-ID: <CAJDDKr4sXp7qqhzHN2_5sJeqaV23Z_uDiFsU_eFJrT5ApuWiTQ@mail.gmail.com> (raw)
In-Reply-To: <50686605.6020909@dirk.my1.cc>

On Sun, Sep 30, 2012 at 8:32 AM, Dirk Süsserott <newsletter@dirk.my1.cc> wrote:
> Am 30.09.2012 17:24 schrieb Tomas Carnecky:
>> On Sun, 30 Sep 2012 17:17:53 +0200, Dirk SÃŒsserott <newsletter@dirk.my1.cc> wrote:
>>> Hi!
>>>
>>> I have repo1 with ~4 years of history and another repo2 with ~1 year of
>>> history, both of which I don't want to loose. Now I want to join them so
>>> that repo2 becomes a subdirectory whithin repo1, including all the
>>> history of repo2.
>>>
>>> A simple git-merge won't do because both repos have some same files (at
>>> least e.g. .gitignore) in their root directories. Of course I could
>>> resolve the conflicts, but I don't want that.
>>>
>>> My naive approach is "move everything in $repo2 one directory below" and
>>> then "merge $repo2 into $repo1". Actually I wouldn' call that a "merge"
>>> but an "import".
>>>
>>> I know of "git filter-branch --subdirectory-filter foodir" but that's
>>> just the opposite of what I need.
>>>
>>> Is there a nifty trick to get this? Or will I have to do "git
>>> filter-branch --tree-filter 'mkdir subdir && git mv * subdir' --all" on
>>> $repo2 and then "git merge $repo2" in $repo1?
>>
>> http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html
>>
>>
>
> Wow! Thanks for that quick and *very* helpful answer! :-)

Hi Dirk,

You should also take a look at contrib/subtree/ in the git source tree.

"git subtree" does pretty much exactly what you're looking to do,
and it is a bit more user-friendly than the plumbing commands.

https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt
-- 
David

  reply	other threads:[~2012-09-30 20:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-30 15:17 Merging/joining two repos (repo2 should be a subdirectory of repo1) Dirk Süsserott
     [not found] ` <1349018675-ner-5178@calvin>
2012-09-30 15:32   ` Dirk Süsserott
2012-09-30 20:44     ` David Aguilar [this message]
2012-10-03 12:52       ` Dirk Süsserott
     [not found] ` <269806202.iK1l2OpKr4@blacky>
2012-09-30 15:38   ` Dirk Süsserott

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJDDKr4sXp7qqhzHN2_5sJeqaV23Z_uDiFsU_eFJrT5ApuWiTQ@mail.gmail.com \
    --to=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=newsletter@dirk.my1.cc \
    --cc=tomas.carnecky@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).