git - Comment supprimer un sous-module

Mots clés : gitgit-submodulesgit

meilleur 4 Réponses git - Comment supprimer un sous-module

vote vote

99

0. mv a/submodule a/submodule_tmp  1. git submodule deinit -f -- a/submodule     2. rm -rf .git/modules/a/submodule 3. git rm -f a/submodule # Note: a/submodule (no trailing slash)  # or, if you want to leave it in your working tree and have done step 0 3.   git rm --cached a/submodule 3bis mv a/submodule_tmp a/submodule 
git add mysubmodule/file.txt  Path 'mysubmodule/file.txt' is in submodule 'mysubmodule' 
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper deinit \   ${GIT_QUIET:+--quiet} \   ${prefix:+--prefix "$prefix"} \   ${force:+--force} \   ${deinit_all:+--all} "$@" 
vote vote

84

# Remove the submodule entry from .git/config git submodule deinit -f path/to/submodule  # Remove the submodule directory from the superproject's .git/modules directory rm -rf .git/modules/path/to/submodule  # Remove the entry in .gitmodules and remove the submodule directory located at path/to/submodule git rm -f path/to/submodule 
vote vote

76

git rm -r the_submodule rm -rf .git/modules/the_submodule 
git config -f .git/config --remove-section submodule.the_submodule 2> /dev/null 
vote vote

70

git rm --cached $submodulepath git config -f .git/config --remove-section submodule.$submodulepath 

Questions similaires