Managing a Hugo theme using git submodules
For this Hugo-powered website, I decided to use the Toha theme, available on Github.
Although the documentation has a great “Getting started” guide, I was missing some steps on how to upgrade a theme to its current version.
Following some comments, apparently this is not something that is done often, unless there are significant updates in either functionality or layout.
I tend to disagree, so I want to make sure I have the correct steps at hand.
Initializing git repository
Before executing any of the other commands below, make sure you have initialized your git repository by issuing the following command:
$ git init
Adding a theme
Once you have initialized your git repository, you can go ahead and add one or more themes to your website.
In this case, I’ve added the Toha theme as a git submodule using the following command:
$ git submodule add https://github.com/hugo-toha/toha.git themes/toha
Updating a theme
When it is time to update your theme, it is as simple as updating the git submodule.
$ git submodule update --remote --merge