Delete Submodule
Use Git Submodule to manage your file version: Delete Submodule
Categories:
Method 1
1. Change submodule folder name
mv
<path/to/submodule-folder>
<path/to/rename-submodule-folder>
mv app/submodule-app app/submodule-app-tmp
2. Delete submodule setting
git submodule deinit -f –
<path/to/submodule-folder>
git submodule deinit -f -- app/submodule-app
3. Remove submodule from the .git
folder
rm -rf .git/modules/
<path/to/submodule-folder>
rm -rf .git/modules/app/submodule-app
4. Delete submodule from git
git rm -f
<子模組路徑>
git rm -f
<path/to/submodule-folder>
git rm -f app/submodule-app
Method 2
1. Remove submodule from the .gitmodules
files
[submodule "app/submodule-app"]
path = app/submodule-app
url = git@github.com:kejyun/app-submodule.git
2. Add .gitmodules
to the stage status
git add .gitmodules
3. Delete .git/config
Submodule Setting
[submodule "app/submodule-app"]
url = git@github.com:kejyun/app-submodule-app.git
active = true
4. Remove submodule from the working directory
git rm –cached
<path/to/submodule-folder>
git rm --cached app/submodule-app
5. Remove submodule from the .git/modules
rm -rf .git/modules/
<path/to/submodule-folder>
rm -rf .git/modules/app/submodule-app
6. commit changes about the submodule
git commit -m "Removed submodule <app/submodule-app>"
7. Delete submodule folder
rm -rf
<path/to/submodule-folder>
rm -rf app/submodule-app