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