Skip to content

Instantly share code, notes, and snippets.

@pitchart
Created September 30, 2016 12:10
Show Gist options
  • Save pitchart/9d88a67e44a386ad6e4405c5fc5b8c19 to your computer and use it in GitHub Desktop.
Save pitchart/9d88a67e44a386ad6e4405c5fc5b8c19 to your computer and use it in GitHub Desktop.
Register git submodule from a .gitmodule file
#!/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