git submodule重新使用

If you haven’t already run git rm --cached path_to_submodule (no trailing slash) as well as rm -rf path_to_submodule, do that!

Then:

  1. Delete the relevant lines from the .gitmodules file. e.g. delete these:
1
2
3
[submodule "path_to_submodule"]
path = path_to_submodule
url = https://github.com/path_to_submodule
  1. Delete the relevant section from .git/config. e.g. delete these:
1
2
[submodule "path_to_submodule"]
url = https://github.com/path_to_submodule
  1. rm -rf .git/modules/path_to_submodule

Then, you can finally:

1
git submodule add https://github.com/path_to_submodule
请作者喝一杯咖啡☕️