Skip to Content

How to delete git submodule

Posted on

My blog use hugo framework, and install theme by using git submodule.

Each time I change my theme, I want to completely remove submodule of old themes.


  • Open .gitmodules files, remove relevant section.
  • Stage the .gitmodules changes: git add .gitmodules
  • Open .git/config, remote relevant section.
  • Run git rm --cached path_to_submodule
  • Run rm -rf .git/modules/path_to_submodule
  • Commit git commit -m "Removed submodule"
  • Delete the submodule: rm -rf path_to_submodule


comments powered by Disqus