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

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

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Mar 9, 2026, 21:03 UTC
Message-ID
<aa81ivufua5uJ4nb@fruit.crustytoothpaste.net>
In-Reply-To
<20260309193001.GD309867@coredump.intra.peff.net>
On 2026-03-09 at 19:30:01, Jeff King wrote:
Show 15 quoted lines
> These days we also have git-for-each-repo. It is primarily about running
> a command in a set of otherwise unrelated repos. But I wonder if:
> 
>   git for-each-repo --submodules do-this
> 
> would be a natural fit as an alternative to "git submodule foreach"? And
> then you can imagine a "--current" option to discover the current repo
> and include it in the list. And then:
> 
>   git for-each-repo --submodules --current do-this
> 
> would do what you want.
> 
> I dunno. I do not have any need for this myself, but just thinking out
> loud.

I think this would be quite useful especially if it could operate on submodules before the parent repository. My particular use case is with the SHA-256/SHA-1 interoperability work, since that would allow people to recursively convert submodules into interoperability mode and then the main repository (which needs the submodule mappings first). This seems like a thing others will want to do as well.

So while I'm not planning to work on this myself, I think this would be a fantastic feature to add.

-- 
brian m. carlson (they/them)
Toronto, Ontario, CA
Previous: Jeff KingNext: D. Ben Knoble
Message 5 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.