0

I have a repo with 2 submods inside of it. When in the main repo and switching branches, or pulling changes, seemingly at random, the submods will leave the branch I told them to be on and switch to "HEAD (string of numbers and letters)". I know this is the version of the submodule I last pushed to my main repo, but that's not what I want.

This is demolishing my workflow, and making me lose submod changes sometimes. I need git to never, ever, under any circumstances, change the branch I set my two submods to be on, no matter what I do to the main repo. How do I make that possible?

phd
  • 82,685
  • 13
  • 120
  • 165
andSam
  • 1
  • 1
  • 1
    This is how `git submodule update` works: https://stackoverflow.com/a/55570998/7976758 See also other answers found at https://stackoverflow.com/search?q=%5Bgit-submodules%5D+detached+HEAD – phd Dec 28 '22 at 18:03
  • You cannot change how git `submodule update` works but you can create a `post-checkout` hook in the superproject that checks out necessary branches in the submodules. – phd Dec 28 '22 at 18:05

0 Answers0