From: Junio C Hamano Date: Thu, 15 Oct 2015 23:21:50 GMT Subject: Re: Make "git checkout" automatically update submodules? Message-ID: In-Reply-To: Kannan Goundan writes: > 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. > ... > 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? I think it is mostly because the area has a lot of corner cases and different workflows. For example ... > [1] Our post-checkout procedure is: > > git submodule sync > git submodule update --init > git submodule foreach --recursive \ > 'git submodule sync ; git submodule update --init' ... this will clearly not work well for everybody, as you do not want to instantiate _all_ the submodules _unconditionally_. Well, "you" (Kannan) and your project may want to, but not necessarily other large projects (e.g. imagine Android using submodules). So you can view the current status being "nothing is instantiated by default", which _is_ far from satisfactory than the ideal case where perhaps the project can specify in .gitmodules which submodules are to be instantiated by default, add labels to modules in .gitmodules so that "git clone" of a top-level project with submodules can be told "git clone --init-submodules=