Removing a submodule

Wednesday 17/07/19

Don't you love it when you move the wrong repository into your repository as a submodule? That's what happened to me.

Here's how to remove a submodule from a git repo!

  1. Open up your Command Prompt / Terminal / Powershell and navigate to your git repository.

  2. Run git rm --cached [Submodule Name]

  3. Delete the [Submodules] entry from the .gitmodules file.

  4. Delete the [Submodules] entry from the .git/config file.

  5. Commit the changed untracked files.

  6. Delete the submodule folder.

  7. Delete the submodule directory in the .git/modules directory.

Last updated

Was this helpful?