Thread (2 messages) flat view 2 messages, 2 authors, 2026-03-09

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

From: Florian Schmidt <hidden>
Date: 2026-03-09 12:52:12

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help