Skip to content

Instantly share code, notes, and snippets.

@costa
Last active December 23, 2025 18:16
Show Gist options
  • Select an option

  • Save costa/dd16f5490dd8122022841d9943d231f9 to your computer and use it in GitHub Desktop.

Select an option

Save costa/dd16f5490dd8122022841d9943d231f9 to your computer and use it in GitHub Desktop.
Do not be afraid of submodules! Run this from the umbrella repo directory, give it the path to a subdirectory with a GitHub-checked-out (sub) repo in it.
#!/bin/bash
test "$#" -ne 1 && echo "USAGE ...git-hub-submodulate <PATH-TO-SUB-REPO-FROM-GITHUB>" >&2 && exit 145
git submodule add --name "$1" "$( git -C $1 config --get remote.origin.url )" "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment