Re: Make "git checkout" automatically update submodules?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kannan Goundan <kannan@xxxxxxxxxxx> 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=<label>" to instantiate the modules
that match the given label after the top-level is cloned, etc. etc.

But such a way to allow these more complicated situations to be
handled nicely has not been designed by anybody, so for now "nothing
instantiated by default" stands as the safest default.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]