Skip to content

Instantly share code, notes, and snippets.

@miwgel
Created June 2, 2023 15:18
Show Gist options
  • Save miwgel/dac88259a8840aba98d4efb728020b15 to your computer and use it in GitHub Desktop.
Save miwgel/dac88259a8840aba98d4efb728020b15 to your computer and use it in GitHub Desktop.
The best way to remove a Git Submodule

Remove Git Submodules

Run in terminal

  • git rm <path-to-submodule>
  • rm -rf .git/modules/<path-to-submodule>
  • git config --remove-section submodule.<path-to-submodule>

Example:

  • Open terminal
  • cd /Users/You/Documents/Github/MySaucyProject
  • git rm ./lib/SubmoduleThatIDespise
  • rm -rf .git/modules/lib/SubmoduleThatIDespise
  • git config --remove-section submodule.lib/SubmoduleThatIDespise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment