2

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?

phd
  • 82,685
  • 13
  • 120
  • 165
SeqSEE
  • 94
  • 8

1 Answers1

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