0

Here is my scenario:

Master-branch:

git main repo [branch:master]
-> submodule
---> subMod_A [branch:alfa tracking origin/alfa]

Hotel-branch

git main repo [branch:hotel]
-> submodule
---> subMod_A [branch:beta trakcking origin/beta]

Edit 1 [clarification]:

Changing from Master to Hotel branch, also changes the submodule branch from alfa to beta branch. This is intended.

We do this because we have electronics with minor variations in implementation.

When I switch between Master and Hotel, the submodule HEAD is always detached. I've already tried with submodule.subMod_A.update=rebase/merge with the same result.

Edit 2:

git submodule status 

The output confirms that it is on the new branch with the correct commit id. But I still have to "reattach" it by hand with checking out the branch again

What would be the best/standard way of achieving this?

Best regards framet

framet
  • 3
  • 2
  • 1
    That isn't the way submodules are intended to be used, I think. – matt Sep 20 '21 at 13:06
  • https://stackoverflow.com/search?q=%5Bgit-submodules%5D+detached+HEAD – phd Sep 20 '21 at 14:32
  • I've seen those question. I've tested it and it is working when root repo changes the branch but the submodule branch is the same. In my particular case changing the main repo branch should also switch the submodule branch to another branch. I could not get it to work. Therfor I aksed this specific question. – framet Sep 20 '21 at 15:10

0 Answers0