We've started using Repo (described here: https://source.android.com/source/developing.html) to manage our set of git repositories. After doing init and sync, all the repositories have detached HEADs.
When the manifest version of a repository is a branch, I would like to automatically create a local branch tracking the remote one, for all git repositories in the manifest. Is that possible?
yes use the repo forall command. Look at repo help forall for more information.
for more info see https://source.android.com/source/using-repo.html#forall
If you want to specify the manifest revisions exactly (these will generally be the branch names specified in the manifest) but manifests can contain SHAs as well.
repo forall -c 'git branch new_branch $REPO_RREV'