Created
November 15, 2024 11:18
-
-
Save dogukanarat/15ea76022d3cca368537b2f34f22964c to your computer and use it in GitHub Desktop.
Script file to extract all git submodule and create text file that contains git command to initialize them
This file contains hidden or 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 | |
output_file="submodule_add_commands.sh" | |
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") | |
command="git submodule add $url $local_path" | |
echo "$command" | |
echo "$command" >> "$output_file" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment