ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Remove a git submodule from your repository

    Scheduled Pinned Locked Moved IT Discussion
    gitsubmodulehugothemecleanup
    1 Posts 1 Posters 435 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JaredBuschJ
      JaredBusch
      last edited by JaredBusch

      Since I have been playing with Hugo, I also have started using git submodule, as that is the recommended way to add a theme.

      Adding is easy enough, but how do you clean up your git repo once you have added a half dozen themes for testing things out?

      Well it is 5 commands.

      git submodule deinit <submodule_path>
      git rm <submodule_path>
      git commit-m "Submodule removed"
      rm -rf .git/modules/<submodule_path>
      git push
      

      Here is a full example. Assuming you are in the base folder of the hugo site.
      in my case cd ~/repos/jaredbusch.com

      git submodule deinit themes/hugo-tikva/
      git rm themes/hugo-tikva/
      git commit-m "Submodule removed"
      rm -rf .git/modules/themes/hugo-tikva/
      git push
      
      1 Reply Last reply Reply Quote 4
      • 1 / 1
      • First post
        Last post