From: D. Ben Knoble Date: Mon, 09 Mar 2026 22:14:33 GMT Subject: Re: Option for "git submodule foreach" to also run on the parent git? Message-ID: In-Reply-To: <032a7767-2350-4312-a7b1-75080519c72a@nutanix.com> On Mon, Mar 9, 2026 at 8:56 AM Florian Schmidt wrote: > > 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 || :'" 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 This is not particularly general-purpose, but don't we have submodule.recurse (-> switch, checkout) and submodule.propagateBranches to make this kind of branching workflow easier? -- D. Ben Knoble