A collection of GIT specialized tasks that require diving into Stack Overflow for getting the correct answers.
Changing remote repository for a git submodule
# Edit the .gitmodules file to update the URL git submodule sync
https://stackoverflow.com/a/914090
How do I move an existing Git submodule within a Git repository?
git mv old/submod new/submod
git 1.9.3+
https://stackoverflow.com/a/24767348
Note: Always use git bash / mingw32. Do NOT use git from Windows’ command line.
How do I remove a submodule?
git submodule deinit -f path/to/submodule # Remove the entry from .git/config rm -rf .git/modules/path/to/submodule # Remove the directory from .git/modules/ git rm -f path/to/submodule # Remove the entry in .gitmodules and the submodule directory
git 1.7.8+
https://stackoverflow.com/a/36593218
How to update a superproject where submodules have changed in remote and/or local folder
First, check out the latest state at the superproject. It should contain an updated .gitmodule file. Then:
git submodule sync # Propagate the changes from the .gitmodule file git submodule update # Check out the proper commits from the submodules git reset --all # Remove old submodule folders