What if I want to use an older version of a theme on Netlify?

The docs page on Hosting on Netlify has a note that says:

The git clone method for installing themes is not supported by Netlify.

A better approach is to install a theme as a proper git submodule.

I am assuming this means I will be using the latest version of the theme; is this right? And if so, what do I do if I want to use an older version of a theme?

No, you can add any version you want as a Git submodule. You would have to look in the Git docs to get the details of that.

Oh, cool. Thanks, @bep, I’ll take a look at the git docs.

I’m looking at 7.11 Git Tools - Submodules and git-submodule on git-scm.com, but I don’t know what I’m looking for. The theme I’m using is Academic, and George Cushen seems to have tagged versions, so we have:


When I write the command:

git submodule add https://github.com/<THEMECREATOR>/<THEMENAME>

can I just use the link with the version I want?

git submodule add https://github.com/gcushen/hugo-academic/tree/v0.29.0

UPDATE: I just tried doing that from inside my themes folder, and got this warning:

remote: Not Found
fatal: repository 'https://github.com/gcushen/hugo-academic/tree/v0.29.0/' not found

When I use a theme as a submodule for my sites, Git keeps track of the state of the submodule, and the commit/version I want to stay at. When you create the submodule, it downloads the latest code, but then you can explicitly checkout a particular commit (or tag) before committing the new submodule in the site’s repo.

The effect of this is that you will not automatically use the most updated version of a theme on a rebuild, but rather the particular version you are tracking. To update your theme, you go into the submodule’s directory and fetch the latest updates, then make a new commit in your site’s repo to track the new state of the submodule.

I hope this makes sense.

1 Like

Hi @Shadow53,
It makes sense, so I just need to know how to do that in practice. The theme I have in mind seems to have tags or trees for different versions. Would this be what I need to write?

git submodule add https://github.com/<THEMECREATOR>/<THEME>.git checkout tag 'v2.0'

Add the repo as a submodule the normal way. Then, you go into that submodule and you can operate on it like any other repo. So you checkout tags or branches or whatever. But that takes more commands, and you really need to read the whole submodules chapter to get all that.

Or, you don’t have to worry about tracking it like that at all. Once you add it as a submodule, it is pinned to that commit point for the added repo. It won’t change, unless you explicitly make it. That means it won’t actually update without your involvement.

So something like git submodule add https://github.com/gcushen/hugo-academic.git is all you need to get started.


Thanks, @maiki, I’ll try that and look into the submodules chapter.