From: John Keeping <john@keeping.me.uk>
To: Martin von Gagern <Martin.vGagern@gmx.net>
Cc: git@vger.kernel.org
Subject: Re: Merging after directory got turned into submodule
Date: Tue, 11 Aug 2015 14:25:31 +0100 [thread overview]
Message-ID: <20150811132530.GG30507@serenity.lan> (raw)
In-Reply-To: <55C9F271.30008@gmx.net>
On Tue, Aug 11, 2015 at 03:02:41PM +0200, Martin von Gagern wrote:
> I've noticed that if I turn a subdirectory into a submodule, I'm having
> severe trouble merging branches from before that change, even if they
> don't modify that subdirectory at all.
>
> I've posted this problem on Stack Overflow and started a bounty for it.
> See http://stackoverflow.com/q/31821219/1468366. So far I haven't
> received an answer, so I decided to ask here as well.
>
> Here is an example.
>
> # Create one project, to be used as a subproject later on
> git init a
> cd a
> echo aaa > aa
> git add -A
> git commit -m a1
> cd ..
>
> # Create a second project, containing a as a normal directory initially
> git init b
> cd b
> mkdir a b
> echo aaa > a/aa
> echo bbb > b/bb
> git add -A
> git commit -m b1
>
> # Replace directory with submodule
> git rm -r a
> git submodule add ../a a
> git commit -m b2
>
> # Create feature brach starting at version without submodule
> git submodule deinit . # will error if I don't do this
> git checkout -b branch HEAD^
> echo abc > b/bb
> git commit -a -m b3
>
> # Try to merge the feature branch
> git checkout master
> git merge branch
>
> This prints an error message:
>
> > CONFLICT (file/directory): There is a directory with name a in branch.
> > Adding a as a~HEAD
> > Automatic merge failed; fix conflicts and then commit the result.
>
> I get the same error if I do a git submodule update --init before the
> git merge branch. I don't see any a~HEAD anywhere, neither in my
> directory tree nor in the output from git status, which reads like this:
>
> > On branch master
> > You have unmerged paths.
> > (fix conflicts and run "git commit")
> >
> > Changes to be committed:
> >
> > modified: b/bb
> >
> > Unmerged paths:
> > (use "git add <file>..." to mark resolution)
> >
> > added by us: a
>
> If I do git add a as suggested, I get another error:
"git reset a" works for me (i.e. set a to what it was before merging).
If you then commit and check "git ls-tree HEAD" it shows "a" is still a
submodule.
prev parent reply other threads:[~2015-08-11 13:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-11 13:02 Merging after directory got turned into submodule Martin von Gagern
2015-08-11 13:25 ` John Keeping [this message]
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=20150811132530.GG30507@serenity.lan \
--to=john@keeping.me.uk \
--cc=Martin.vGagern@gmx.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.