Skip to content

Instantly share code, notes, and snippets.

@docteurklein
Created May 10, 2011 21:43
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 docteurklein/965444 to your computer and use it in GitHub Desktop.
Save docteurklein/965444 to your computer and use it in GitHub Desktop.
init submodules from a .gitmodules file
#!/bin/bash
for cfg in `git config -f .gitmodules -l`
do
url=`echo $cfg | awk -F"submodule.*.url=" '{print $2}'`;
if [ -n "$url" ]; then
echo "git submodule add $url $path";
git submodule add $url $path;
url="";
else
path=`echo $cfg | awk -F"submodule.*.path=" '{print $2}'`;
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment