A Win for Distributed Version Control


The company that hosts this very website recently had a catastrophic outage. The webserver was lost, and it turned out the backups weren't being written off-server as they should have. That is, of course, a huge bummer, but these sorts of things happen.

I'm noting this context, not to berate my hosting provider, a small, local, company whom I continue to be glad to support, rather than hosting my website with one of the tech giants. But instead to set the stage for the true moral of the story.

Thanks to distributed version control, I didn't lose anything.

If you read the official documentation at https://git-scm.com, you'll see Git described as:

[...] a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Yet day to day, I find that the vast majority use Git as something that is rather explicitly a centralized version control system.

One central system, be it GitHub, GitLab, Bitbucket, or for that matter, Codeberg, serves as the canonical source of truth for our data. We check out the state so we can make changes, and merge them back in. Treating our local copy as a rather ephemeral mirror of the Source Of Truth™, and nothing more.

But part of the very beauty of Git, is that everything is distributed. When you check out a local copy, you get all of the data. All the history, all the deleted version, everything. Unless you actively choose not to anyway.

So although I had configured my web server as the git remote, storing a full copy of my website and all its history. My computer had the exact same data as well. And when I was notified the provider had to replace the server, all I had to do was call git remote set-url origin [new server], and I was all set.

As basic as that is, it sure beats the reliability many SaaS platforms offer these days.