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

Option for "git submodule foreach" to also run on the parent git?

From
Florian Schmidt <flosch@nutanix.com>
Date
Mar 9, 2026, 12:52 UTC
Message-ID
<032a7767-2350-4312-a7b1-75080519c72a@nutanix.com>
Hey everyone,

would there be an appetite for a new option to "git submodule foreach" to run the foreach command on the parent git repo as well?

I occasionally use "git submodule foreach", for example, to make dev branches on all the submodules if I expect to touch them all during a dev cycle. Even if I don't need them on all submodule, once I'm done with everything, I might run something like "git submodule foreach 'git branch -d <foo> || :'" for easy cleanup.

In either case, I likely also want to run the same command on the parent git. That's easily achieved by just running it manually one more time, and I'm sure it's not hard to make a git alias for that either. But I wonder whether the workflow is common enough that there's interest in adding a command-line option for that? I'd be happy to have a look in that case.

Also, tangentially related, "|| :" works, but what about a command line option to continue on non-zero return values and not abort?

Cheers, Florian

Next: Junio C Hamano
Message 1 of 6 in “Option for "git submodule foreach" to also run on the parent git?”
  1. Florian SchmidtMar 9, 2026
  2. Junio C HamanoMar 9, 2026
  3. Florian SchmidtMar 9, 2026
  4. Jeff KingMar 9, 2026
  5. brian m. carlsonMar 9, 2026
  6. D. Ben KnobleMar 9, 2026

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.