git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG?] Issue with merging from another branch after replacing subdirectory with submodule

From
Stefan Beller <sbeller@google.com>
Date
Apr 6, 2017, 23:05 UTC
Message-ID
<CAGZ79kaGQHvGv-ZpfppbATucrJWVdS8Lq33CKs5AbV7qDGE3BA@mail.gmail.com>
In-Reply-To
<CAA-fqg2EwfMQ-KoAMHDFca1c7jpQgihhqsLejEK3Zs8O1D4DLg@mail.gmail.com>
On Wed, Apr 5, 2017 at 11:10 PM, Ben Nason <bnason@netflix.com> wrote:
Show 7 quoted lines
> Hi,
>
> In git if you replace a subdirectory with a submodule in one branch,
> every successive merge from another branch without that change will
> cause a conflict. To reproduce this please see below (DOS batch file).
>
> Is this expected behavior?
Yes.

"git submodule update [--init]" only (creates or) updates existing submodules. It doesn't take care of removing submodules that are no longer recorded in the tree.

"git merge" currently also does not touch submodules. (we may have git merge --recurse-submodules soon, though). So as soon as there is a conflict between the submodule (or an unrelated repo, who happens to live inside this other repo), and new directories/files that would appear, the merge errors out.

Ideally Git would be smarter than the current behavior.
Stefan
Previous: Ben NasonNext: Ben Nason
Message 2 of 3 in “[BUG?] Issue with merging from another branch after replacing subdirectory with submodule”
  1. Ben NasonApr 6, 2017
  2. Stefan BellerApr 6, 2017
  3. Ben NasonApr 7, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.