I have two git repositories: A
and B
. I want to make B
a submodule of A
. B
has no master
branch.
I ran the following command from A
's repository root:
git submodule add [email protected]:B lib/B
Which yields the following output:
Cloning into 'lib/B'...
remote: Counting objects: 156, done.
remote: Compressing objects: 100% (151/151), done.
remote: Total 156 (delta 45), reused 0 (delta 0)
Receiving objects: 100% (156/156), 109.80 KiB | 140 KiB/s, done.
Resolving deltas: 100% (45/45), done.
fatal: You are on a branch yet to be born
Unable to checkout submodule 'lib/B'
My .gitmodules
file has no entry for B
, but .git/modules/lib/B
exists. If I cd lib/B
, I can git checkout develop
(B
's only branch), but git sees any files under lib/B
as part of A
.
Is there any way to tell git to add a submodule that has no master
branch?
This will add the branch you specify as a submodule
git submodule add -b <branch> ...
You can find this information by doing git submodule -h
or man git-submodule
Link to man page for git submodule