Created
November 17, 2015 05:52
-
-
Save landaire/25d231fca4b3af62d7cd 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/sh | |
# Created by Lander Brandt | |
# This script will take all existing cloned subprojects and add them as | |
# proper git submodules | |
# To use, run this script from within the main project's root directory | |
set -e | |
for submodule in `git ls-files --stage | grep 160000 | cut -f 2`; do | |
url=`(cd $submodule && git config --get remote.origin.url)` | |
echo $PWD | |
git rm --cached $submodule | |
git submodule add $url $submodule | |
echo $url | |
echo $submodule | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment