A submodule always in a disconnected head state because Git does not store any information about which branch it should be.
Git tracks the binding of the submodule to which it is connected, because it is saved along with the commit information. When you merge two different branches that are associated with different submodule , Git cannot check a branch in the submodule for why you have a separate HEAD.
There is no solution that allows your submodules to connect to the branch.
Possible solution to your problem:
https://github.com/kollerma/git-submodule-tools
nowox source share