I have a git repository with three submodules. The containing repository has two branches master
and develop
. All submodules only have one branch – the master
branch.
When the containing repository is on the master branch, pushing to origin via git push --recurse-submodules=on-demand
works as expected. Both the containing project as well as its submodules are pushed.
Now here is the problem. When the containing repository is on the develop
branch, I am getting a problem when pushing via git push --recurse-submodules=on-demand
. The push operation is cancelled and an error message is printed.
Here is the full output I get from git:
$ git push --recurse-submodules=on-demand
fatal: src refspec 'refs/heads/develop' must name a ref
fatal: process for submodule 'Frameworks/OpenLearnWareClient' failed
I can mitigate this problem by first pushing changes in each submodule manually and then pushing the containing repository. This however is very tedious and defeats the purpose of --recurse-submodules=on-demand
.
Here is my .gitmodules
file:
[submodule "Frameworks/OpenLearnWareKit"]
path = Frameworks/OpenLearnWareKit
url = [email protected]:kaiengelhardt/OpenLearnWareKit.git
branch = master
[submodule "Frameworks/OpenLearnWareClient"]
path = Frameworks/OpenLearnWareClient
url = [email protected]:kaiengelhardt/OpenLearnWareClient.git
branch = master
[submodule "Frameworks/KEFoundation"]
path = Frameworks/KEFoundation
url = [email protected]:kaiengelhardt/KEFoundation.git
branch = master
I am using git version 2.20.1 (Apple Git-117).
Does anybody know what is going wrong here and how to make recursive pushing work?
git push --recurse-submodules=on-demand
on mydev
branch, and it successfully pushed a new commit to a submodule. (Note: no PR workflow was used here, just pushing directly to my own branch) – Romish--recurse-submodules=no
. Obviously that's not the case in the OP, but leaving this comment for future searchers. My submodules both have detached heads. – Coati