Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+4 votes
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

+2 votes
by (50.2k points)
edited by

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

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

For more information please go through the following tutorial to get more info about git:

Easy way to pull latest of all git submodules
Intellipaat-community
by (5.8k points)
Helpful. Thanks.

Related questions

0 votes
1 answer
+4 votes
2 answers

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...