# Git: How to remove submodule

*2021-11-12*

> Remove a Git submodule by updating .gitmodules and .git/config, removing it from the index, and deleting the untracked files.

Quick tip on how to remove Git submodule.

1. Remove the relevant line from the _.gitmodules_ file
1. Delete the relevant section from _.git/config_ _(if any)_
1. Run

   ```sh
   git rm --cached path_to_submodule
   ```

    (without trailing slash)
1. Commit and delete the now untracked submodule files.

