From: Brian Gernhardt <benji@silverinsanity.com>
To: H Merjin Brand <h.m.brand@xs4all.nl>
Cc: Git List <git@vger.kernel.org>,
Lars Noschinski <lars-2008-1@usenet.noschinski.de>
Subject: Merging submodules
Date: Wed, 30 Jul 2008 18:59:39 -0400 [thread overview]
Message-ID: <20080730225939.GA6471@Hermes> (raw)
This message got eaten by a syntax error somewhere. This is a re-send, sorry for any duplicate messages.
On Jul 30, 2008, at 9:58 AM, H.Merijn Brand wrote:
> One (very) big disadvantage of SCCS is that commits are on a per-file
> basis, and only in a single directory. This drawback still haunts me in
> git, as my first attempts to convert were successful in a single folder
> and git cannot merge folders into a single project.
>
> Say I now have
>
> /work/src/project/.git
> /work/src/project/module_a/.git
> /work/src/project/module_b/.git
> /work/src/project/module_c/.git
>
> Which are all converted repos from SCCS, I'd like to merge the three
> module_# repos into the top level repo.
Following the example of Linus, the following is completely untested.
First you fetch all of the heads/tags/etc into the superproject with commands like
git fetch module_a refs/heads/*:refs/remotes/module_a/*
git fetch module_b
refs/heads/*:refs/remotes/module_b/*
git fetch module_c
refs/heads/*:refs/remotes/module_c/*
Then you do something like:
rm -rf module_{a,b,c}/.git # Do this in a test repository, obviously...
git add module_a module_b module_c
git commit # Needed because '-s ours' uses current HEAD, not index
git merge --no-commit -s ours module_a/master module_b/master module_c/master
git commit --amend
>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.
You may need to "git rm --cached" some files after the "git add" step if your .gitignore files aren't perfect.
~~ Brian
next reply other threads:[~2008-07-30 23:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-30 22:59 Brian Gernhardt [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-07-30 23:03 Merging submodules (was Re: Feature suggestion: git-hist) Brian Gernhardt
2008-07-31 7:21 ` H.Merijn Brand
2008-07-31 12:39 ` Merging submodules H.Merijn Brand
2008-07-31 13:06 ` Petr Baudis
2008-07-31 15:01 ` H.Merijn Brand
2008-07-31 15:24 ` Santi Béjar
2008-07-31 18:15 ` H.Merijn Brand
2008-07-31 19:03 ` Santi Béjar
2008-07-31 20:44 ` H.Merijn Brand
2008-08-01 7:04 ` H.Merijn Brand
2008-08-01 9:52 ` Santi Béjar
2008-08-01 10:35 ` H.Merijn Brand
2008-08-01 11:34 ` Santi Béjar
2008-08-04 13:24 ` H.Merijn Brand
2008-08-04 13:40 ` Petr Baudis
2008-08-04 13:57 ` H.Merijn Brand
2008-08-04 14:06 ` Petr Baudis
2008-07-31 13:17 ` Santi Béjar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080730225939.GA6471@Hermes \
--to=benji@silverinsanity.com \
--cc=git@vger.kernel.org \
--cc=h.m.brand@xs4all.nl \
--cc=lars-2008-1@usenet.noschinski.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).