Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install git submodules from a .gitmodules file
#!/bin/sh
set -e
git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
while read path_key path
do
url_key=$(echo $path_key | sed 's/\.path/.url/')
url=$(git config -f .gitmodules --get "$url_key")
git submodule add $url $path
done
@AhmedBHameed

This comment has been minimized.

Copy link

@AhmedBHameed AhmedBHameed commented Nov 28, 2019

Thank you for the nice script. But why git dose not respect .gitmodules file which already created when you add a new repo. ??

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