1

I have three repositories: A, B and C.

In my repository A, I created a submodule toward B (A/library/B).

In my repository B, I created a submodule toward C (A/library/B/library/C).

I want to create a new branch on my repository C:

git clone --recursive C
cd C
git checkout -b branch-test
git touch test
git add test
git commit -m "test"
git push origin branch-test

Now I want to create a branch on my repository B and that on my new branch, the submodule toward C follows the branch I previously created:

git clone --recursive B
cd B
git checkout -b branch-test
cd library/C
git checkout branch-test
cd ../../
git add library/C
git commit -m "Updating version of submodule C"
git push origin branch-test

Until there, no problem. The problem appears when I do the same on my repository A:

git clone --recursive A
cd A
git checkout -b branch-test
cd library/B
git checkout branch-test

Now, when I'm going to A/library/B and I type "git branch", I can see I'm on branch "branch-test" of my submodule B. But when I'm going to A/library/B/library/C and I type "git branch", I can see I'm on a detached commit and not on the branche "branch-test".

Do you know why ?

Regards, Ben

1 Answers1

0

Detached heads are very common even without layers of submodules.

Have you applied the advice found here?

Community
  • 1
  • 1