Submodule in git is always in detached state, there is no other way.
If you want to update submodule:
git checkout master #or <your remote branch name>
If you want to pull and merge submodule:
git pull origin master #or <your remote branch name>
First, you commit like usual, but then you have to clarify the destination in your push command.
If you want to push to the remote master branch (the default one):
git push origin HEAD:master
If you want to push to a certain remote branch:
git push origin HEAD:<your remote branch name>
SourceTree should ask you where to push your commit to. But not like that in Visual Studio Code, you still have to do it by hand typing.