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

Re: Make "git checkout" automatically update submodules?

From
Stefan Beller <sbeller@google.com>
Date
Oct 23, 2015, 17:20 UTC
Message-ID
<CAGZ79kYMyU5h8uQkNEpMU558FgLrNM52_aQsXud6CrBAUgFSNA@mail.gmail.com>
In-Reply-To
<loom.20151016T001449-848@post.gmane.org>
On Thu, Oct 15, 2015 at 3:50 PM, Kannan Goundan <kannan@cakoose.com> wrote:
Show 30 quoted lines
> 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.)
>

Checkout [1]. There are lots of good patches, but hard to find. (Including, but not limited to a recursive git checkout enhancement!)

That said I've recently started working on submodules, too. I am trying to push my work upstream as fast as possible as that works best for us.

[1] https://github.com/jlehmann/git-submod-enhancements/wiki
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 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.