Skip to content

Instantly share code, notes, and snippets.

@willhallonline
Created November 7, 2018 15:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willhallonline/4b10f65540099aee9dc06d9269775c18 to your computer and use it in GitHub Desktop.
Save willhallonline/4b10f65540099aee9dc06d9269775c18 to your computer and use it in GitHub Desktop.
#!/bin/sh
# This script will add all submodules from just a .gitmodules file
#
set -e
git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
while read path_key path
do
url_key=$(echo $path_key | sed 's/\.path/.url/')
url=$(git config -f .gitmodules --get "$url_key")
git submodule add $url $path
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment