Created
December 23, 2015 16:44
-
-
Save aaronjorbin/40d37d7720292b829cb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
git config -f .gitmodules --get-regexp '^submodule\..*\.path$' > tmpfile | |
while read -u 3 path_key path | |
do | |
url_key=$(echo $path_key | sed 's/\.path/.url/') | |
url=$(git config -f .gitmodules --get "$url_key") | |
read -p "Are you sure you want to delete $path and re-initialize as a new submodule? " yn | |
case $yn in | |
[Yy]* ) rm -rf $path; git submodule add $url $path; echo "$path has been initialized";; | |
[Nn]* ) echo "ok. Skipping $path";; | |
* ) echo "Please answer yes or no.";; | |
esac | |
done 3<tmpfile | |
rm tmpfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment