I have a repo with multiple submodules. I have a commit’s hash but do not know to which submodule it belongs, how I could find it’s exact submodule?
>Solution :
Run git show in all submodules, recursively; hide error messages, ignore errors; report the submodule when the hash is found (git show doesn’t return error):
git submodule foreach -q --recursive 'git show -q $hash 2>/dev/null && echo $name || :'
See the docs.