Skip to content

Instantly share code, notes, and snippets.

@landaire
Created November 17, 2015 05:52
Show Gist options
  • Save landaire/25d231fca4b3af62d7cd to your computer and use it in GitHub Desktop.
Save landaire/25d231fca4b3af62d7cd to your computer and use it in GitHub Desktop.
#!/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