Re: Merge two repos with history included? (was Re: How do I..?)

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

 



On Tuesday 23 December 2008 03:44:07 Miklos Vajna wrote:
> On Mon, Dec 22, 2008 at 02:04:06PM -0800, Dylan Martin <dmartin@xxxxxxxxxxxx> wrote:
> > I checked, and my initial SVN to git conversion does contain history.
> > 
> > I'm trying to add an exising repo as a subdir of my main repo with
> > history included.  Can anyone tell me how to do that?
> 
> I would try the following: Let's say you have super.git and foo.git, and
> you want to merge foo.git to the subdirectory 'foo' of super.git. Then
> you can do in foo.git:
> 
> mkdir foo
> mv * foo
> git add foo
> git commit -a
> 
> Then in super.git:
> 
> git pull path/to/foo.git master
> 
> And then git log --follow should work just fine on any merged files as
> well.
> 


If the conversion is one-shot, you can also try rewriting commits like this:

cd foo.git
git filter-branch --commit-filter 'TREE=$1; shift; git commit-tree $(echo -e "040000 tree $TREE\tfoo" | git mktree) "$@"' master

(Maybe there is a simpler way, though)

I used this once to merge together the history of a bunch of interrelated (and now dead) projects.

Alexander
--
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