git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Finn Arne Gangstad <finnag@pvv.org>
To: git@vger.kernel.org
Subject: Submodules and merging
Date: Sat, 8 Dec 2007 19:40:31 +0100	[thread overview]
Message-ID: <20071208184030.GA21613@pvv.org> (raw)

>From an earlier discussion here on the mailing list I had the
impression that there was some support for merging submodules from the
supermodule. This does not seem to be the case, but I think it would
be very good if this WAS possible?

Here is the shortest example that still mimics "real" work that shows
the problem. Assume change1 and change2 are done by two different
people in two different repositories and push this into separate
branches in a central repo somewhere. A maintainer at the central
repo wants to merge in one or both changes:


# Create directory and some repos with a simple README
rm -rf submodule-test
mkdir submodule-test
cd submodule-test
( mkdir super-module; cd super-module; git init )
( mkdir sub-module; cd sub-module; git init )

cd super-module
echo 'this is the super module' > README
git add README
git commit -m 'added a readme'

cd ../sub-module
echo 'this is the sub module' > README
git add README
git commit -m 'added a readme'
cd ..

# Make a testdir, clone the master repo, and add
# the sub-module
mkdir testdir
cd testdir
git clone `pwd`/../super-module
cd super-module
git submodule add `pwd`/../../sub-module
git commit -m 'added the submodule'

# make change1 on a branch in both super and sub module
git checkout -b change1 
cd sub-module/
git checkout -b sub-change1
echo 'This is change1' > change1
git add change1
git commit -m 'added change1 file'
cd ..
git add sub-module
git commit -m 'did change1 in change1 branch'

# Make change2 on a branch in both super and sub module
git checkout -b change2 master
git submodule update
cd sub-module/
git checkout -b sub-change2
echo 'this is change2' > change2
git add change2
git commit -m 'added change2 file'
cd ..
git add sub-module
git commit -m 'did the change2 change'

# Try to merge change1 and change2
git checkout -b mergetest master
git submodule update
git merge change1
git merge change2 



This fails with the somewhat obscure error message:
fatal: cannot merge modes?
Merge with strategy recursive failed.

- Finn Arne

                 reply	other threads:[~2007-12-08 18:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20071208184030.GA21613@pvv.org \
    --to=finnag@pvv.org \
    --cc=git@vger.kernel.org \
    /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).