I have a huge repo project with many git subprojects. (It is AOSP) I want to find specific branches everywhere in the repo project. Is there already a command to list all (or matched) branches in all git subprojects or does it need some scripting? Do git submodules support such a command?
Example of expected output:
sub/project1:main
sub/project1:v1
sub/project2:main
sub/project2:v1
...
Solution:
repo forall -p -c git for-each-ref --format="%(refname:short)" refs/heads/*
Nice feature of "repo forall -p" that it prints subproject path only if a subcommand has an output. Hence paths without branches, which is common for repo, are not printed. Only paths with local branches are printed!
"git for-each-ref ..." prints raw list of branches