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

Re: Restart submodule update --recursive

From
Johan Herland <johan@herland.net>
Date
Oct 28, 2010, 10:35 UTC
Message-ID
<201010281235.14313.johan@herland.net>
In-Reply-To
<loom.20101028T090353-376@post.gmane.org>
On Thursday 28 October 2010, Lukasz Palczewski wrote:
Show 14 quoted lines
> Hi.
> I have a problem with the time and the stoping of the submodule
> update command when the error occures.
> In our project we have lots of submodules with submodules in them. So
> I use git command: git submodule update --recursive, to update all
> the submodules, but it take some time to do it. I have to do it quite
> often becouse I'm a tester of the software and I usually don't know
> which submodule I need to update, to have the newest version. If I
> have some local changes in some submodule, the command stops and I
> have to revert the changes and start the submodule update from the
> begining again.
> Is there a way to start the submodule update from the place, where
> the error occured and the command stop? Something like:
> git submodule update --recursive --restart_form_last_error

No, but you can use 'git submodule foreach --recursive "$SCRIPT"', where $SCRIPT is a command (or list of commands) for updating your current submodule. As long as the SCRIPT returns successfully (exit value 0), the submodule foreach will keep going into each submodule. You can the look at the output from your script to deduce which submodules need to be updated manually. Or you may even be able to solve your problem automatically.

You could for example try something like (all on one line):

git submodule foreach --recursive "git fetch && git stash && git checkout $sha1 && git stash pop; true"

...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net
Previous: Lukasz PalczewskiNext: Lukasz Palczewski
Message 2 of 11 in “Restart submodule update --recursive”
  1. Lukasz PalczewskiOct 28, 2010
  2. Johan HerlandOct 28, 2010
  3. Lukasz PalczewskiOct 29, 2010
  4. Jonathan NiederOct 28, 2010
  5. Lukasz PalczewskiOct 29, 2010
  6. Jonathan NiederOct 29, 2010
  7. Lukasz PalczewskiOct 29, 2010
  8. Jonathan NiederOct 29, 2010
  9. Jens LehmannOct 30, 2010
  10. Lukasz PalczewskiNov 2, 2010
  11. Jens LehmannNov 2, 2010

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.