I currently have a repo on github that contains a submodule. In order to update the submodule in any place I do a git pull
to pull the main repo but have to do a git pull origin master
from the directory of the submodule in order to update the submodule. Is there any way to update the submodule automatically when I do a git pull
in the main project repo?
Asked
Active
Viewed 551 times
2
-
https://stackoverflow.com/search?q=%5Bgit-submodules%5D+update – phd Feb 12 '20 at 18:58
1 Answers
5
From man git pull
:
git pull --recurse-submodules=yes
--[no-]recurse-submodules[=yes|on-demand|no]
This option controls if new commits of all populated
submodules should be fetched and
updated, too (see git-config(1) and gitmodules(5)).
If the checkout is done via rebase, local submodule commits
are rebased as well.
If the update is done via merge,
the submodule conflicts are resolved and checked out.

alan ocallaghan
- 3,116
- 17
- 37