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

Make "git checkout" automatically update submodules?

From
KGKannan Goundan <kannan@cakoose.com>
Date
Oct 15, 2015, 22:50 UTC
Message-ID
<loom.20151016T001449-848@post.gmane.org>

Git submodules seem to be a great fit for one of our repos. The biggest pain point is that it's too easy to forget to update submodules.

1. I often forget since most repos don't need it.
2. Infrequent users of our repo almost never know to update submodules and
end up coming to us with strange build errors.
3. Existing scripts that work with Git repos are usually not built to handle
submodules.

In the common case of the submodule content having no local edits, it would be nice if "git checkout" automatically updated submodules [1]. If there are local edits, it could error out (maybe override with "--ignore-modified-submodules" or something).

I'm not a Git expert, though. Is there a reason something like this isn't already implemented? Maybe there's an existing write-up or mailing list thread I can read to get some background information?

Thanks!
[1] Our post-checkout procedure is:
    git submodule sync
    git submodule update --init
    git submodule foreach --recursive \
      'git submodule sync ; git submodule update --init'

(Not sure if this is correct. Different articles/blogs suggest a slightly different set of commands.)

Next: Junio C Hamano
Message 1 of 10 in “Make "git checkout" automatically update submodules?”
  1. Kannan GoundanOct 15, 2015
  2. Junio C HamanoOct 15, 2015
  3. Kannan GoundanOct 22, 2015
  4. Junio C HamanoOct 23, 2015
  5. Kannan GoundanOct 23, 2015
  6. Christian CouderOct 23, 2015
  7. Junio C HamanoOct 23, 2015
  8. Stefan BellerOct 23, 2015
  9. Junio C HamanoOct 23, 2015
  10. Kannan GoundanOct 23, 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.