Re: How-to combine several separate git repos?

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

 



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