{"thread":{"id":"14768","subject":"Merging submodules","startedAt":"2008-07-30T22:59:39Z","lastAt":"2008-07-30T22:59:39Z","messageCount":1,"participants":["Brian Gernhardt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"85703","messageId":"20080730225939.GA6471@Hermes","threadId":"14768","inReplyTo":null,"subject":"Merging submodules","fromName":"Brian Gernhardt","fromEmail":"benji@silverinsanity.com","sentAt":"2008-07-30T22:59:39Z","receivedAt":"2008-07-30T22:59:39Z","isPatch":false,"sender":{"key":"benji@silverinsanity.com","avatar":"https://gravatar.com/avatar/e06c101dbc25c68114d859b4a9ec7cf8a2c52fd2b0270ef0eac0e2e63ff22311?d=mp&s=160"},"body":"This message got eaten by a syntax error somewhere.  This is a re-send, sorry for any duplicate messages.\n\nOn Jul 30, 2008, at 9:58 AM, H.Merijn Brand wrote:\n\n> One (very) big disadvantage of  SCCS  is that commits are on a per-file\n> basis, and only in a single directory. This drawback still haunts me in\n> git, as my first attempts to convert were successful in a single folder\n> and git cannot merge folders into a single project.\n> \n> Say I now have\n> \n> /work/src/project/.git\n> /work/src/project/module_a/.git\n> /work/src/project/module_b/.git\n> /work/src/project/module_c/.git\n> \n> Which are all converted repos from SCCS, I'd like to merge the three\n> module_# repos into the top level repo.\n\nFollowing the example of Linus, the following is completely untested.\n\nFirst you fetch all of the heads/tags/etc into the superproject with commands like\n\ngit fetch module_a refs/heads/*:refs/remotes/module_a/*\ngit fetch module_b\nrefs/heads/*:refs/remotes/module_b/*\ngit fetch module_c\nrefs/heads/*:refs/remotes/module_c/*\n\nThen you do something like:\n\nrm -rf module_{a,b,c}/.git # Do this in a test repository, obviously...\ngit add module_a module_b module_c\ngit commit # Needed because '-s ours' uses current HEAD, not index\ngit merge --no-commit -s ours module_a/master module_b/master module_c/master\ngit commit --amend\n\n>From this point on, the project repository has a merged history of the sub-projects, and if anyone doesn't catch up and still makes a commit on a subproject you can use \"git merge -s subtree\" to merge it in anyway.\n\nYou may need to \"git rm --cached\" some files after the \"git add\" step if your .gitignore files aren't perfect.\n\n~~ Brian\n"}]}