Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save guyhughes/4dcf3c30828c7d717b3c to your computer and use it in GitHub Desktop.
Save guyhughes/4dcf3c30828c7d717b3c to your computer and use it in GitHub Desktop.
# http://stackoverflow.com/questions/10606101/automatically-add-all-submodules-to-a-repo
for i in $(ls -d bundle/*); do if [ -d "$i"/.git ]; then git submodule add $(cd $i && git remote show origin | grep Fetch | awk '{print $3}') ./$i; fi; done

Usage Case

A directory like ~/.vim with a sub directory like ~/.vim/bundle with many git repos. "Is there any way of just recursively going through and adding all submodules?" -- Stackoverflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment