Created
June 29, 2023 14:35
-
-
Save raphaelchaib/c2698816779e1fdbe087b94c281476b9 to your computer and use it in GitHub Desktop.
Git Submodules: Read the .gitmodules file and add them to the index, following path rules
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 | |
set -e | |
git config -f .gitmodules --get-regexp '^submodule\..*\.path$' | | |
while read path_key local_path | |
do | |
url_key=$(echo $path_key | sed 's/\.path/.url/') | |
url=$(git config -f .gitmodules --get "$url_key") | |
git submodule add $url $local_path | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment