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

git clone --recursive should run git submodule update with flag --remote

From
SStanislav <s.seletskiy@gmail.com>
Date
Nov 11, 2015, 12:46 UTC
Message-ID
<loom.20151111T133121-436@post.gmane.org>
Consider two repositories, A and B.
Repo A is embedded into B by using submodule:
  git submodule add -b master <url-to-A> sub-a
So, submodule sub-a is set to track master branch of the repo A.

Running git submodule update --remote inside repo B will automatically update and checkout submodule sub-a to the latest master commit (as expected).

However, when using git clone --recursive <url-to-B>, repo B will be cloned with submodule A checkouted to the commmit which was recorded on git submodule add command, not the master commit.

Expected behaviour is to automatically update checkout commit pointed by branch, that was specified by -b flag in the git submodule add invocation.

Reason for this behaviour is that line:
  https://github.com/git/git/blob/master/builtin/clone.c#L99
I guess, it should be changed to include --remote flag.
Next: Stefan Beller
Message 1 of 2 in “git clone --recursive should run git submodule update with flag --remote”
  1. StanislavNov 11, 2015
  2. Stefan BellerNov 11, 2015

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.