Skip to content

Instantly share code, notes, and snippets.

@mehlah
Created July 2, 2012 00:27
Show Gist options
  • Save mehlah/3030170 to your computer and use it in GitHub Desktop.
Save mehlah/3030170 to your computer and use it in GitHub Desktop.
Batch git submodule add
#!/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
@dimti
Copy link

dimti commented Jun 27, 2016

Perfect tool :)
Very thanks.

@bennyhuo
Copy link

Nice!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment