Skip to content

Instantly share code, notes, and snippets.

@system123
Created March 19, 2015 08:50
Show Gist options
  • Save system123/15ee23bf36cf67bac730 to your computer and use it in GitHub Desktop.
Save system123/15ee23bf36cf67bac730 to your computer and use it in GitHub Desktop.
Setup git sub-modules from an existing .gitmodules file in a new repo.
#!/bin/sh
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