git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Riesen <raa.lkml@gmail.com>
To: Peter Waller <peter.waller@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Merging repositories and their histories
Date: Mon, 18 Aug 2008 21:40:21 +0200	[thread overview]
Message-ID: <20080818194021.GA3262@steel.home> (raw)
In-Reply-To: <d3d284ca0808181115j2c9ab5ecufb66780f45d28207@mail.gmail.com>

Peter Waller, Mon, Aug 18, 2008 20:15:52 +0200:
> 2008/8/18 Alex Riesen <raa.lkml@gmail.com>
> 
> > Peter Waller, Mon, Aug 18, 2008 18:46:14 +0200:
> > >
> > > I have three repositories, A, B and C. I wish to bring them
> > > together to only one repository (.), where they are in a
> > > directory called ./Archive, so..  ./Archive/{A,B,C}. Then I plan
> > > at a later date to move files arbitrarily from
> > > ./Archive/{A/B/C}/Something and into ./Something{A/B/C}. (A lame
> > > example, but illustrates what I want to do).
> >
> > If this transition is meant to be persistent (IOW, the A, B and C stop
> > existing as repos on their own) you can rewrite their histories to be
> > in the directories (with git filter-branch) and just merge them in
> > one. Then the histories will look like as if they have never grown
> > separately.
> >
> I don't quite understand what you are suggesting I do.
> 
> I have looked over the filter-branch manpage.
> 
> What would I first do? Copy all three repositories to ./Archive/{A,B,C}?

Fetch, actually.

    $ mkdir combined && cd combined
    $ git init
    $ git fetch ../A master:A
    $ git fetch ../B master:B
    $ git fetch ../C master:C

> Then rewrite their histories?

There is an example at the end of git-filter-branch manpage. Search
for "To move the whole tree into a subdirectory". Just use A, B and C
instead of HEAD as last argument.

Then checkout one of the new, the rewritten, branches, and merge the
two others into it:

    $ git checkout A
    $ git merge B
    $ git merge C

That's it.

  parent reply	other threads:[~2008-08-18 19:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-18 16:46 Merging repositories and their histories Peter Waller
2008-08-18 17:35 ` Alex Riesen
2008-08-18 18:16   ` Peter Waller
     [not found]   ` <d3d284ca0808181115j2c9ab5ecufb66780f45d28207@mail.gmail.com>
2008-08-18 19:40     ` Alex Riesen [this message]
2008-08-18 21:25       ` Peter Waller
2008-08-21 21:48 ` Marcus Griep
2008-08-21 21:53   ` Peter Waller
2008-08-22 12:19   ` Alex Riesen

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=20080818194021.GA3262@steel.home \
    --to=raa.lkml@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peter.waller@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.
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).