Re: Merging repositories and their histories

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

 



Peter Waller, Mon, Aug 18, 2008 20:15:52 +0200:
> 2008/8/18 Alex Riesen <raa.lkml@xxxxxxxxx>
> 
> > 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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