I finally decided to version control my blog, now that I have a tiny self hosted forgejo instance.
While right now, all I want is version control so that I can pull my files down wherever I want.
I might want to play with automatically deploying it via actions too at some later date.
So, with all this in mind, what files do I commit to the repo?This is my current tree. Does all of it, go in?
In general you only have to commit the folders where you have self created files.
If a folder is empty no need to commit.
Special handling:
archetypes
Only needed when you use hugo new content
resources:
Usually generated at build. If you don’t want to optimize with caching fe. when doenloading external ressources or expensive operations. You dont need it
A .gitignore file in the root of your project, which you do commit, typically looks something like this:
.hugo_build.lock
node_modules/
public/
resources/
If you have already committed some of these files:
git rm -rf .hugo_build.lock node_modules/ public/ resources/
git add -A
git commit -m "Remove extraneous files from source control"
One possible exception to this is the resources directory which, by default, contains some of the cached build artifacts: processed images and stylesheets. If you use a CI deployment workflow (e.g., Cloudflare Pages, GitHub Pages, GitLab Pages, Netlify), builds can be significantly faster if you include this directory in source control.