Skip to main content

submodule_remove

Function submodule_remove 

Source
pub fn submodule_remove(
    repo_path: &Path,
    name: &str,
    path: &Path,
) -> Result<(), String>
Expand description

Deletes the submodule registered as name and checked out at path (relative to the repository root): deinitialises it, removes its gitlink, .gitmodules entry and working directory with git rm, then deletes its module directory under the git dir so re-adding it later starts clean. The result is staged, not committed.

git submodule deinit and git rm take a path. The name differs from it after git submodule add --name or a git mv, and only locates the module directory: passing the name to git rm once deleted an unrelated tracked file that happened to share it. Nothing is changed unless path is a submodule (gitlink) entry in the index.