0

I am new to the submodule feature of git and at the moment I am struggling with the .gitmodules configuration. What I want is to initialize the submodule and checkout to the develop branch and not to the head.

My .gitmodules looks like the following:

[submodule "test-submodule"]
    path = test-submodule
    url = https://...
    update = checkout develop

When I run

git submodule init

I get the following error: fatal: invalid value for submodule.test-submodule.update

Any help is welcome.

Yusuf Ipek
  • 166
  • 1
  • 11
  • 1
    `submodule..update` configuration variable [can be](https://git-scm.com/docs/git-submodule#Documentation/git-submodule.txt-update--init--remote-N--no-fetch--no-recommend-shallow-f--force--checkout--rebase--merge--referenceltrepositorygt--depthltdepthgt--recursive--jobsltngt--no-single-branch--ltpathgt82308203) `checkout`, `rebase` or `merge` and nothing else. – phd Dec 07 '21 at 15:01
  • if you can't specify a branch, then what is checkout good for? – Yusuf Ipek Dec 07 '21 at 15:02
  • You specify the branch [separately](https://git-scm.com/docs/gitmodules#Documentation/gitmodules.txt-submoduleltnamegtbranch) – phd Dec 07 '21 at 15:07
  • I see, I tried it, it checkout to the latest commit of the develop branch. If I go to the submodule folder and call "git branch", then the output tells me "HEAD detached at ...." is the active branch and not the develop branch. Do you have any idea how I can set the develop branch as active? – Yusuf Ipek Dec 07 '21 at 15:16
  • 1
    "**HEAD detached is the default behavior of** `git submodule update`" See https://stackoverflow.com/a/55570998/7976758 , https://stackoverflow.com/search?q=%5Bgit-submodules%5D+detached+HEAD – phd Dec 07 '21 at 15:20

0 Answers0