Skip to content

Instantly share code, notes, and snippets.

@novrian
Created June 27, 2013 22:28
Show Gist options
  • Save novrian/5880960 to your computer and use it in GitHub Desktop.
Save novrian/5880960 to your computer and use it in GitHub Desktop.
Init Submodule bash script. Thanks to Mark Longair - http://stackoverflow.com/questions/11258737/restore-git-submodules-from-gitmodules
#!/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