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

Should "git submodule update" accepts --init?

From
Nazri Ramliy <ayiehere@gmail.com>
Date
May 11, 2017, 06:11 UTC
Message-ID
<CAEY4ZpMJbS+-xDKcwbOHCWxAdjOVuTN9DFJNHVqHw0r06CwKJg@mail.gmail.com>
Hi,

The command "git submodule update" accepts an "--init" flag to initialize an uninitialized submodules.

Shouldn't it also accept "--sync" flag in order to sync and unsync'd submodule?

Otherwise it seems like I'll have to do "git submodule update" twice in order to update an already initialized submodule whose upstream repo url has been updated in .gitmodules to point to somewhere new, like so:

$ cd superproject $ git pull $ git submodule update --init --recursive fatal: reference is not a tree: c21784553dcd15e1534773fe3177f39cbb93be65 Unable to checkout 'c21784553dcd15e1534773fe3177f39cbb93be65' in submodule path 'path/to/submodule' Failed to recurse into submodule path 'path/to/submodule' $ git submodule sync $ git submodule update --init --recursive

If the submodule update subcommand accepts the "--sync" flag then above can then be simplified to this:

$ cd superproject $ git pull $ git submodule update --init --sync --recursive

So the "--init" and "--sync" flags tells git to initialize an uninitialized submodule, and syncs any out-of-sync submodules.

nazri
Next: Junio C Hamano
Message 1 of 3 in “Should "git submodule update" accepts --init?”
  1. Nazri RamliyMay 11, 2017
  2. Junio C HamanoMay 11, 2017
  3. Nazri RamliyMay 11, 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.