Created
July 7, 2009 17:57
-
-
Save demonbane/142249 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
# Got a bunch of subdirectories in a project that aren't submodules, but should be? | |
# Here's a quick way to add them all. Just change the find command to only look in | |
# the directory you want. | |
for dir in `find vendor/extensions -type d -name .git`; do url=`cd "$dir" && git config --get remote.origin.url`; dir="${dir%/.git}"; git rm -r --cached "$dir" && git submodule add "$url" "$dir"; done | |
## Or, slightly more readable | |
for dir in `find vendor/extensions -type d -name .git`; do | |
url=`cd "$dir" && git config --get remote.origin.url` | |
dir="${dir%/.git}" | |
git rm -r --cached "$dir" && git submodule add "$url" "$dir" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment