How do I replace a git submodule with a different git repo?
Specifically, I have a submodule:
./ExternalFrameworks/TestFramework
First, delete the current submodule with the method already mentioned here, which I'm including for convenience:
.gitmodules file.git/configgit rm --cached path_to_submodule (no trailing slash)Now, add the new submodule with the --name flag. This will give git an alternate name to reference in .git/config for the submodule, to deconflict with the submodule that was there historically, which you still want to work in your prior history.
So type:
git submodule add --name UpdatedTestFramework git@github.com:userB/TestFramework.git
and you'll get the submodule loaded at the path you expect.