Adding a Hugo theme as a Git Submodule

Some scratch notes on setting up a Hugo theme as a Git Submodule...

Go to your Hugo site's themes directory and git clone the theme.

Then go to the root of your Hugo site and add the submodule:

1git submodule add themes/<name_of_theme>

Update the submodule with latest pushes with:

1git submodule update --remote

If you want to change the branch of the git submodule, you can do that with:

1git config -f .gitmodules submodule.themes/<name_of_theme>.branch <name_of_branch>

If you want to remove the submodule, just simply remove it. Optionally, delete the folder in the .git hidden directory. (Believe it not, this is the official recommendation).

1git rm themes/<name_of_theme>
2rm -rf .git/modules/themes/<name_of_theme>