0

I have a submodule which I wish to be on head. Whenever I

git submodule update --recursive

on the main repo, I get this output:

Submodule path 'my_submodule': checked out '0076552d05a0eed244c7bca8aas224086e65a'

and then with git branch in the submodule:

* (HEAD detached at 0076552)
  master

This is definitely not the behavour I want, and it doesn't happen with other submodules I have - how can I fix this?

phd
  • 82,685
  • 13
  • 120
  • 165
Omroth
  • 883
  • 7
  • 24
  • 3
    That is the normal behavior – EncryptedWatermelon Nov 25 '19 at 11:14
  • The more interesting question is, why *doesn't* it happen with other submodules? (I suspect it's because they're already on the right commit hash so that `git submodule update` does not need to yank them to a different one.) – torek Nov 25 '19 at 11:19
  • Ok, thank you - how do I change it so that it stays attached to head when it is updated please? – Omroth Nov 25 '19 at 11:22
  • adding --remote to the update fixes it, although I would prefer to have this submodule automatically tracking head – Omroth Nov 25 '19 at 11:31
  • https://stackoverflow.com/search?q=%5Bgit-submodules%5D+branch – phd Nov 25 '19 at 11:44

0 Answers0