Using a Git Submodule for Your Theme
If you have a repository for your Jekyll or Hugo project and you want use a different repository for your theme, you should set up your theme repo as a Git Submodule.
Hugo modulesHugo has also its own module management system, it’s fast and offers more possibilities. Here’s a tutorial to get started with Hugo modules.
To add a theme as a Git Submodule, run the following command from the root of your project:
git submodule add https://github.com/spf13/hyde.git themes/hyde
Be sure to add the correct URL to your theme repo and the correct path to where you want this repo to live within your project.
Once you create the submodule, you’ll notice a
.gitmodules file in the root of your project. Commit this file as well as the module inside of your theme directory to your project.
If you need to make a change to this theme, the changes should be pushed to the original repository you created the submodule from. You can then update the submodule on your site with the following command:
git submodule update --remote
This is also how you update a third-party theme that you have installed as a submodule.
Caught a mistake or want to contribute to the docs? Edit this page on Github!