My personal codebase

9/17/2023

I am a nerd who writes code in his free time and cares about nerd stuff. That means I need some way to save my code, and somewhere to store it. To most programmers, the obvious solution is Github. But for me, that's not good enough.

To explain what version control even is, let's use an analogy of a Microsoft Word document. I have been writing an essay that is over a thousand words long in a file called essay.docx. It's 90% finished, and I want to try out a slightly different format, but I don't want to lose my work. I could make a copy of the file called temporary-essay.docx, but let's say I like that version, so instead I name it to final-essay.docx Except now I want to make another change. final-final-essay.docx. And another. final-for-real-this-time-essay.docx. I think you get the point. And I know that, just like me, you've also made about 15 revisions of the same essay in one folder with slightly different names. Then, when you have to go sort out which is which, you have to open them one at a time and remember which final-final essay is the real one.

This is why programmers use version control. Instead of one file, we often have to edit tens (if not hundreds) of files to get a program to work. If we had to "version" each file this way, it would get out of control so fast, and no one would know which file was the real one. So instead, we use tools to help us make versions. The most famous example is Git . Git is an incredibly powerful version control tool. Inside of a project, you can make a repository that keeps track of all your changes. These changes are called commits. Each commit should, in theory, have entirely working code in it. And instead of making new file version names, we make branches off our code. We can then merge branches to have the aspects we like most from either one.

So then what is Github ? Well, it's a place where you can store your git repositories. Think of it like a cloud backup, expect specially designed for code. Github is a very popular tool. It was an independent company until 2018, when it was acquired by Microsoft. For most people, this wasn't enough to stop using it for personal code. But for me, it was enough to make me question whether I should store my code on it.

I personally support free and open source software. Some people misinterpret the free part of that to mean free-as-in-cost, but really it means free-as-in-freedom. Freedom at the software level is the ability to freely inspect and modify source code. This allows experienced developers like myself to look for potentially harmful behavior in software, such as quietly collecting data about developers and users . It also allows developers the freedom to create their own versions of the source code that has changes that they want, such as removing features like the one referenced above.

Large corporations such as Microsoft are well known for dubious behavior surrounding personal data in their products, and Github has been no exception. In 2021, Microsoft announced Github Copilot , an AI coding companion. But since it was trained on Github repositories, and since it was in part just a language model, it had some bugs . Some pretty serious bugs . And yeah, the people whose data was gathered by Copilot shouldn't have committed these secret keys, but whatever. My point remains - what was once a mistake on these programmers' parts is now considered absolute truth to an expert system.

So for these reasons and many others that I will not get into the specifics of, I have opted to self host my version control. You can find it at git.hornet.codes . I use Gitea , an open source version control suite that is lightweight enough to run on a Raspberry Pi. I've had a great experience with it so far. It's simple, it does what I want it to do, and it is actively maintained and getting new features like Gitea Actions , a tool similar to Github Actions.

Github Actions is one of the most powerful tools Github offers. It allows users to build, test, release, and deploy source code, all within simple workflow files. If you are a developer and you aren't leveraging some sort of continuous integration/delivery like this, I highly highly recommend you look into it. I use Gitea Actions to build, test, and deploy this website. It leverages a similar system to Github Actions, and can use almost any Github Action plugin. All I have to do is merge code to my production branch, and bingo blammo, it's on my server within a minute. It has increased my productivity tenfold, because I no longer have to manually deploy my code.

I use Gitea because it runs on my servers, it's under my control, I can read the source code, and it's not actively stealing my data. It allows me to fulfill my philosophical needs with code, while never diminishing my efficiency or work capacity. It's also perfectly good at being a version control frontend. If you are like me and you prefer to use free and open source software, and you're still attached to major vendors like Github, I recommend you move to a solution like Gitea. I promise you, it's not as hard as you think, and once you make the switch, you'll never go back.