We have an Azure pipeline in which we specify that submodules should be checked out when the "Get Sources" task is running ...

enter image description here

We are getting our source from a particular branch (named "develop"). How do I specify that I would like the named submodules to also checkout from this branch? Right now, the submodules seem to be defaulting to the master branch.

1

There are 1 answers

0
Levi Lu-MSFT On BEST ANSWER

Azure devops doesnot have the branch filter option for submodules currently. However, you can easily checkout a particular submodule branch using git commands. See below:

First, Check Checkout submodules option to let your pipeline check out the submodules,just like what you did in above screenshot.

enter image description here

Second, add a script task to run below git commands. You can manually checkout a particular branch for the submodule:

cd SubmoduleFolder  #go in the submodule repo folder
git checkout $(Build.SourceBranchName)  #check out submodule branch.

enter image description here