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

Expected behaviour of 'git submodule update --remote --recursive'?

From
AWAndy Wharton <awharton1976@gmail.com>
Date
Jan 2, 2021, 17:45 UTC
Message-ID
<CANUvzQ12V1ptr9uEpXFnJQWcWgjs4+vTjgaXTMrsJ6foAMpv2Q@mail.gmail.com>
Hi all,
I have three git repo's:
    A imports B as a submodule, and has "branch = ." set for B in .gitmodules
    B imports C as a submodule, and has "branch = ." set for C in .gitmodules

I had hoped that checking out a branch in A, and then running 'git submodule update --remote --recursive' in A would checkout the latest commit from that branch in the two submodules.

This works as expected for B (checks out the right SHA as a deteched head), but because I'm left on a detached head the update fails for C with a "branch configured to inherit branch from superproject" message.

While I'm guessing this is the expected behaviour, is it possible to make the "branch = ." option use the branch name from the parent transitively? Or is there another mechanism I should be using to achieve what I'm trying to do?

Andy.
Message 1 of 1 in “Expected behaviour of 'git submodule update --remote --recursive'?”
  1. Andy WhartonJan 2, 2021

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.