Using Git for website management

git commit -m ‘First post from my laptop’

Now that I have a laptop1, it’s a good idea to make my website editable on multiple machines instead of just my desktop. The simplest way I can think of getting this to work is Git. And no, not Github. I’ll do it myself with regular git.

I actually briefly used Git to manage this website a while ago, but cowardly went back to rsync after I incorrectly committed something and couldn’t roll back. I wasn’t very committed, in hindsight. But now, version controlling actually becomes important since I’m working from multiple devices. Plus, knowing Git might be useful for my future.

The setup is quite simple; I set up a bare repository on my VPS that hosts all files. I pull to my desktop or laptop, make changes, and push. I can’t directly use the repo’s files to render HTML though, because the available version of Hugo is outdated on my VPS. Damn you Debian. Instead, I use a separate script to make rsync push rendered HTML files separately to the VPS.

It’s kind of funny how far I came in about two years. I started with hand written HTML, moved to a static site generator, wrote a (tiny) bit of JavaScript, and now I’m using Git to manage my website. I had no idea I’d be doing this when I first started. At this rate, maybe I’ll even be doing amateur web dev work later.