git update submodule code example

Example 1: Update submodules

git submodule update --init --recursive

Example 2: git update all submodules

git submodule update --recursive --remote

Example 3: git update submodule recursive

git submodule update --init --recursive

Example 4: git add submodule branch

git submodule add -b branch_name URL_to_Git_repo optional_directory_rename

Example 5: git pull onbly submodule

git submodule update --remote <path to the submodule>

Example 6: git checkout branch and update submodules

git checkout --recurse-submodule