Skip to content

Instantly share code, notes, and snippets.

@barrydobson
Last active June 23, 2020 07:19
Show Gist options
  • Save barrydobson/56191e491050a7797c53f78888130ee1 to your computer and use it in GitHub Desktop.
Save barrydobson/56191e491050a7797c53f78888130ee1 to your computer and use it in GitHub Desktop.
GIT submodules
# Add a submodule tracking master
git submodule add -b <branch> <repo> <name>
# Update a submodule
git submodule update --remote
# Update a submodule from a parent repo
cd path/to/submodule
git add <files>
git commit -m "comment"
git push
cd /main/project
git add path/to/submodule
git commit -m "updated my submodule"
git push
# Remove a submodule
git submodule deinit <path_to_submodule>
git rm <path_to_submodule>
git commit-m "Removed submodule"
rm -rf .git/modules/<path_to_submodule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment