Trouble with Git Submodules
They mean trouble anyway, but here’s a new trick that Git has up it’s sleeve. The problem appears when a submodule does not have a master branch, because you named (or someone else who created the submodule) the branch main, as everyone says you should do these days. The error you get contains the sarcastic sentence:
You are on a branch yet to be born
Thanks for nothing.
The fix is to remove all traces of the submodule (if you don’t, re-cloning will
fail) and re-clone, naming a branch with the -b
option.
Here we go (assuming we are on the top level of the master[1] repo):
rm -fr .git/modules/mysubmodule rm -fr themes/mysubmodule git submodule add -b main ssh://nik@git.drnik.org/home/nik/repo/mysubmodule-theme.git themes/mysubmodule
1. Or should I say main?