Version control for your website: why Git matters to owners
Short answer: If your website or web app is custom-built, its code should live in a Git repository that your business controls, not only on a developer's laptop or the live server. Git records every change with who made it and why, lets you roll back a bad update, and makes handing the project to a new developer far easier. The practical rule for owners: make sure the repository sits in an account in your company's name, and that the live site is deployed from it.
Founders often learn about version control the hard way: a developer leaves, the server is the only copy of the code, and nobody knows which changes are live. This explainer covers what Git is, how it works day to day, when it matters for a small business and how to set it up without becoming a developer yourself.
What version control is
The free Pro Git book on git-scm.com defines version control as a system that records changes to a file or set of files over time so that you can recall specific versions later. It lists what that makes possible: reverting selected files or the entire project to a previous state, comparing changes over time, and seeing who last modified something that might be causing a problem, who introduced an issue and when.
Git is a distributed version control system. GitHub's documentation explains that in a distributed system every developer has a full copy of the project and its history, so they don't need a constant connection to a central server. Pro Git adds that, as a result, every clone is effectively a full backup of the data.
How it works, in owner's terms
A few words come up constantly. GitHub's documentation describes them like this:
- Repository: the collection of files and folders for a project, plus each file's revision history.
- Commit: a snapshot of the project at a point in time; the history is a series of commits.
- Branch: a separate line of development, so a change can be worked on without touching the live version.
- Pull request: on hosting services such as GitHub, a proposal to merge a branch's changes, with space for review and discussion.
A typical change then looks like this: the developer creates a branch, makes the change, commits it with a message ("Fix booking form date validation"), opens a pull request, someone reviews it, it's merged, and the live site is updated from the merged code.
When it matters for a small business
It matters a lot if:
- Your site or app is custom code (a framework, a custom theme, a bespoke web app).
- More than one person works on it, now or in future.
- You pay an agency or freelancer and want the work to remain yours and transferable.
- You've ever had an update break something and needed to know what changed.
It matters less if:
- You use a hosted website builder where you edit content in the browser and there's no code to manage. (Even then, custom code snippets are worth keeping somewhere safe.)
- Your WordPress site uses only an off-the-shelf theme and plugins, with no custom code. Content and plugins are better protected by backups than by Git.
Setting it up as an owner
1. Own the account
Create an organisation on a Git hosting service (GitHub, GitLab and Bitbucket are common examples) in your company's name, using a company email address. Invite developers as members. This way, if a freelancer leaves, the repository stays.
2. Ask for the code to be moved in
If the code currently lives in a developer's personal account, ask for the repository to be transferred to your organisation, or for the full history to be pushed there. Ask for the complete history, not just a zip of the current files, because the history is what lets you understand past changes.
3. Keep secrets out
Passwords, API keys and other credentials shouldn't be committed to the repository. They belong in environment variables or a secrets manager on the hosting side. Ask your developer how secrets are handled; if a key was ever committed, it should be rotated.
4. Deploy from the repository
The live site should be updated from the repository, ideally automatically when changes are merged to the main branch. Editing files directly on the live server creates changes that exist nowhere else, which is how sites drift away from their code.
5. Protect the main branch
Most hosting services let you require a pull request and a review before changes reach the main branch. Even in a two-person team, a second pair of eyes catches mistakes.
6. Ask for readable commit messages
"Update" tells you nothing a year later; "Change opening hours format on contact page" does. Agreeing on this costs nothing.
What to ask a developer or agency
- Where is the repository, and who owns the account?
- Is the live site deployed from it? Is anything on the server not in the repository?
- How are credentials stored?
- How would we roll back a bad release?
- Can we have read access to see changes as they happen?
Clear answers to these are a good sign of a maintainable project.
FAQ
Is Git the same as GitHub?
No. Git is the version control system; GitHub is one service that hosts Git repositories and adds collaboration tools such as pull requests and issue tracking. GitLab and Bitbucket are alternatives.
Is a Git repository a backup?
It's a full copy of the code and its history, and every clone holds that history. It doesn't back up your database, uploaded files or content stored outside the code, so you still need regular backups of those.
Do I need to learn Git myself?
Not to use it well as an owner. You need to own the account, know where the code is, and be able to grant or remove access. Reading the history on the hosting service's website is a useful extra.
What if my developer refuses to use version control?
That's a risk worth raising directly. It makes the project harder to maintain, review and hand over. Agreeing on repository ownership at the start of a project avoids awkward conversations later.
Not sure where your website's code actually lives, or who owns it? Ask us for a quick handover check and we'll tell you what's in place and what's missing.