The Best Way To Use Git as a Small Team
Managing many tiny repositories is a complete nightmare, on the other hand, one big monorepo is not any better, if you're not careful.
In this article I outline the experiments and experience gained throughout the years, where I'm trying to balance time (the trade off between effort on infrastructure vs effort on product) + complexity (how complicated the setup is). It's continuously evolving and in the current state, I think it works quite well.
For context, I'm a software dev of 5+ years, across the site I often use "we" instead of "I" because I always keep in mind that more people may join at any time.
The decisions I make, are what I consider good for a team of 1 to 8 people; Beyond 8+ devs I haven't really considered / put too much thought in.
My Requirements
- Build and deploy 10+ static HTML websites
- Store and deploy code + content (such as this article you're reading now)
- Support both closed source and open source projects
- Deploy some backend server code (built into a Docker image)
Choosing a platform
Here's my opinion on some Git Platforms.
What I use...
- GitLab: Excellent all-rounder that has everything needed to get started, including a super nice CI/CD script - I use this by default
- GitHub: Great discoverability, good for open source - I use this when I'd like to open source something
Others, that I've used in the past...
- Azure Repos: Great for big organizations when you're fully invested in the whole Azure suite.
- Gitea: Something I experimented with for a few months, it was ok, but I missed the Gitlab CI/CD too much.
The Structure
Firstly, let's split by how the code will be presented, that is, open-source vs closed-source.
Open Source
GitHub is excellent for open-source projects, due to discoverability, and I think the overall experience for logged-out users is great.
I have 2 repos there, a snake game + snippets from the youtube channel
- https://github.com/simpleboringgames/mini-snake
- https://github.com/hugosvirak/snippets
I aim the repos are big enough to not be forgotten about.
However, this mini-snake repo is at my minimum limit, and I'm very tempted to merge it into a repo that has a collection of open source games, but I did not do so yet, because I so far do not have any more open-source games.
Closed Source
One massive monorepo*, and it's beautiful.
The monorepo has a folder structure roughly similar to this:
- typescript-projects
- rust-projects
- infrastructure
And the CI just builds everything, but taking advantage of caching as much as possible.
If you're not careful, a mono-repo can quickly become a heavy bloated mess.
*well with 1 exception: the "words" repo: where this blog, and articles, and all sorts of words are hosted, because I wanted to have access to this on my phone.
Thanks for reading
Any problems or suggestions, email me: [email protected]