--- title: Delete a submodule tags: repository,submodule,advanced --- Deletes a submodule from the repository. - Use `git submodule deinit -f -- ` to unregister the specified ``. - Use `rm -rf .git/modules/` to remove the directory of the submodule. - Use `git rm -f ` to remove the working tree of the submodule. ```sh git submodule deinit -f -- rm -rf .git/modules/ git rm -f ``` ```sh git submodule deinit -f -- 30code rm -rf .git/modules/30code git rm -f 30code # Removes the `30code` submodule ```