Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in DevOps and Agile by (29.3k points)

We're using git submodules to manage a couple of large projects that have dependencies on many other libraries we've developed. Each library is a separate repo brought into the dependent project as a submodule. During development, we often want to just go grab the latest version of every dependent submodule.

Does git have a built in command to do this? If not, how about a Windows batch file or similar that can do it?

1 Answer

0 votes
by (50.2k points)

If it’s your first time you need to initiate submodules on their repository for this use 

git submodule update --init --recursive

If git version is above 1.8.2 then add --remote which looks like

git submodule update --init --recursive --remote

--remote will add non-default branches to specified files in .gitmodules or .git/config

For git version 1.7.3 and above use 

git submodule update --recursive

or:

git pull --recurse-submodules

if you want to pull your submodules to the latest commits instead of what the repo points to

Refer: https://git-scm.com/docs/git-submodule

Related questions

+4 votes
1 answer
0 votes
1 answer
+4 votes
2 answers

Browse Categories

...