Skip to content

Instantly share code, notes, and snippets.

@pulecp
Last active October 22, 2015 06:16
Show Gist options
  • Save pulecp/1524f66d5a8a26d98102 to your computer and use it in GitHub Desktop.
Save pulecp/1524f66d5a8a26d98102 to your computer and use it in GitHub Desktop.
Add to submodules from another project with selection
#!/bin/bash
exec 3<submodules
while read -u 3 -r NAME;read -u 3 -r REPO
do
REPO_DIR=`echo $NAME|cut -d '"' -f2`
REPO_URL=`echo $REPO|cut -d '=' -f2`
[ -d $REPO_DIR ] && continue
while true; do
echo "repo_dir: $REPO_DIR $REPO_URL"
read -p "Do you wish to add this submodule? [y/n]" yn
case $yn in
[Yy]* )
git submodule add $REPO_URL $REPO_DIR
break;;
[Nn]* )
break;;
* )
echo "Please answer yes or no.";;
esac
done
done
[submodule "modules/nodejs"]
url = ssh://git@redmine.example.com:2223/puppetmaster/modules/nodejs.git
[submodule "modules/symfony"]
url = ssh://git@redmine.example.com:2223/puppetmaster/modules/inuits-puppet-symfony.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment