combining a hugo theme git repo into a hugo project
I started this off using a theme that I forked and fiddled with a bit. Later on I realised it was kind of annoying to have two repositories (web content, theme), so I combined them into one. First, the git bit:
# in the hugo project dir
$ git remote add theme path/to/theme/repository
$ git fetch theme
$ git subtree add --prefix=themes/themename theme main
That'll add in the theme with it's history, but with everything pushed into a subdirectory - in this case, themes/themename.
I was already using the Hugo/go bastard mod thing, so next, the go bit - add a line like this to the top of the go.mod file:
replace github.com/user/repo => ./themes/themename
Voila - it's been integrated into the repository history and the files are now editable in a subdirectory.