Ads by ProfitSence

Git- How to remove a submodule ?

Last Updated on Wednesday 5th Oct 2022

git remove submodule

To remove a submodule you need to

  • Step 1: Delete the relevant section from the .gitmodules file.
  • Step 2: Stage the .gitmodules changes git add .gitmodules
  • Step 3: Delete the relevant section from .git/config.
  • Step 4: Run git rm --cached path_to_submodule (no trailing slash).
  • Step 5: Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Step 6: Commit git commit -m Removed submodule.
  • Step 7: Delete the now untracked submodule files rm -rf pat