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

From: Florian Schmidt <[email-masked]>
Date: Mon, 9 Mar 2026 17:43:14 +0000

On 2026-03-09 15:15, Junio C Hamano wrote:
> Florian Schmidt <[email-masked]> writes:
> 
>> 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?
> 
> Not from me.  After all, the top-level superproject is not a
> submodule from the point of view of the tree, is it?  If it were
> "git submodule-and-superproject foreach", then perhaps,

True, I was thinking that, but figured an option such as "--also-parent" 
would be sufficiently clear as to what's happening. But I can see that 
it's maybe pretty niche and potentially confusing.

> but at that
> point, wouldn't it be simpler to explain what you are doing as
> 
>      do-this . ;# do it here
>      git submodule foreach do-this ;# do it there all over

That's basically what's I'm doing. I figured instead of doing "foo && 
git submodule foreach foo", a "git submodule foreach --also-parent foo" 
would be marginally neater. But I don't feel strongly about it.

Cheers,
Florian