How to pull all submodules changes

Viewed 769

The scenario is:

I have some submodules with some branches.

  • sdk (develop, release-1.0)
  • api (develop, release-1.0)

And everytime that I need to build my app I just do this

git checkout develop && git submodule foreach --recursive git checkout develop

but then I have to move over every submodule folder and do the pull in the specific branch that I want to.

I'm asking if there is a way to do the same recursive command with pull on specific branch.

1 Answers

After a while, I found this command.

git pull origin branch_name && git submodule foreach --recursive git pull origin branch_name

which is working fine for me.

Also, I have tested with different ways and I found that

git branch && git submodule foreach --recursive git branch

helped me to check in every submodule which branch I was checking out.

Hope that helps you guys!

Related