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

Re: Add an option to automatically submodule update on checkout

From
BWBrandon Williams <bmwill@google.com>
Date
May 8, 2017, 16:48 UTC
Message-ID
<20170508164821.GA179149@google.com>
In-Reply-To
<CAGZ79kaES-3ftadorYnx2wMDc-q7qsG376E1zy-C67Ldt2BO5g@mail.gmail.com>
On 05/08, Stefan Beller wrote:
Show 19 quoted lines
> On Mon, May 8, 2017 at 7:42 AM, Randall S. Becker
> <rsbecker@nexbridge.com> wrote:
> > On May 6, 2017 4:38 AM Ciro Santilli wrote:
> >> This is a must if you are working with submodules, otherwise every
> >> git checkout requires a git submodule update, and you forget it,
> >> and things break, and you understand, and you go to stack overflow
> >> questions
> >> http://stackoverflow.com/questions/22328053/why-doesnt-git-checkout-automatically-do-git-submodule-update-recursive
> >> http://stackoverflow.com/questions/4611512/is-there-a-way-to-make-git-pull-automatically-update-submodules
> >> and you give up and create aliases :-)
> 
> The upcoming release (2.13) will have "git checkout
> --recurse-submodules", which will checkout the submodules at the
> commit as recorded in the superproject.
> 
> I plan to add an option "submodule.recurse" (name is subject to
> bikeshedding), which would make the --recurse-submodules flag given by
> default for all commands that support the flag. (Currently cooking we
> have reset --recurse-submodules, already existing there is push/pull).

Well pull not so much...it'll do a recursive fetch but not a recursive merge/rebase. That is something on the docket to get done in the next couple months though.

Show 21 quoted lines
> 
> > I rather like the concept of supporting --recurse-submodules. The
> > complexity is that the branches in all submodules all have to have
> > compatible semantics when doing the checkout, which is by no means
> > guaranteed. In the scenario where you are including a submodule from
> > a third-party (very common - see gnulib), the branches likely won't
> > be there, so you have a high probability of having the command fail
> > or produce the same results as currently exists if you allow the
> > checkout even with problems (another option?). If you have control
> > of everything, then this makes sense.
> 
> I am trying to give the use case of having control over everything (or
> rather mixed) more thought as well, e.g. "checkout
> --recurse-submodules -b <name>" may want to create the branches in a
> subset of submodules as well.
> 
> Thanks, Stefan
> 
> >
> > Cheers, Randall
> >
-- 
Brandon Williams
Previous: Randall S. Becker
Message 11 of 11 in “Add an option to automatically submodule update on checkout”
  1. Ciro SantilliMay 6, 2017
  2. Randall S. BeckerMay 8, 2017
  3. Stefan BellerMay 8, 2017
  4. Randall S. BeckerMay 8, 2017
  5. Stefan BellerMay 8, 2017
  6. Randall S. BeckerMay 8, 2017
  7. Brandon WilliamsMay 8, 2017
  8. Stefan BellerMay 8, 2017
  9. Junio C HamanoMay 9, 2017
  10. Randall S. BeckerMay 9, 2017
  11. Brandon WilliamsMay 8, 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.