How to manage themes you edit as git submodules?

Hi, all.

I hope I’m asking this question correctly and clearly. :slight_smile:

I created a Hugo site and used a theme I installed as a git submodule. I’m using GitHub Pages for hosting my site. I edited the theme and am now wondering how I should manage those changes.

My first thought was to fork the theme’s repo and use that as my theme’s remote origin. I would be able to commit my theme changes however I’d like. Is there a reason why this isn’t a good idea?

Are there any other good ways to do this or best practices in this regard?

Thanks in advance.

I think you’re on the right track (with forking), but the simplest way is to just override the theme in your root directory: https://gohugo.io/themes/customizing/#override-template-files

I suppose it depends on the degree of changes you want to make.

3 Likes

Ah-ha! You have enlightened me!!! :slight_smile: Thank you very much, @budparr!

2 Likes

@budparr is right about the override thing, but I would (normally) only fork if I have to. Just adding the original theme as a submodule below /themes has its benefits – you can just pull in updates/fixes etc. as you please without thinking about Git merging.

As well as better CI/CD friendliness compared to git clone.