From: Wink Saville Date: Mon, 10 Dec 2007 06:36:35 GMT Subject: Re: How-to combine several separate git repos? Message-ID: <475CDE73.9010505@saville.com> In-Reply-To: Daniel Barkalow wrote: > On Sun, 9 Dec 2007, Wink Saville wrote: > > > Ah, okay. I was assuming that you wanted them to maintain their original > identities (so you'd send stuff off for each of them separately, for > example). > > I think you can do what you want by doing: > > # Set up the new line: > $ mkdir x; cd x > $ git init > $ touch README > $ git add README > $ git commit > > # Add a project "foo" > $ git fetch ../foo refs/heads/master:refs/heads/foo > $ git merge --no-commit foo > $ git read-tree --reset -u HEAD > $ git read-tree -u --prefix=foo/ foo > $ git commit > > And repeat for all of the other projects. > > What's going on here is that you're merging in each project, except that > you're moving all of the files from that project into a subdirectory as > you pull in the content. The resulting repository has one recent dull > initial commit, and then merges in each of the other projects with their > history, with only the slight oddity that they don't go back to the same > initial commit, and the merge renames all of the project's files. > > I think there may be a more obvious way of doing this (it's essentially > how gitweb and git-gui got into the git history), but I'm not sure what it > is, if there is one. > > -Daniel > *This .sig left intentionally blank* > Daniel, Worked like a charm, someday maybe I'll understand why it works:) Wink