Cobra Developers
Blog, Process

Git and version control, explained for business owners

The short answer

Git is version control software that records every change made to a project's code: what changed, when, and who changed it. It lets developers work on separate copies called branches, review changes through pull requests, and return to any earlier version. Business owners should have access to the repository because it is the software.

Git sits underneath our work, from a marketplace with a merge gate to a small scheduled job that runs with no server. It is so basic to how software gets made that developers forget to explain it, and business owners end up paying for something they have never seen and could not locate.

You do not need to use Git. You do need to know what it is, because the repository is the real asset. The website or app your customers see is a product of what is in it.

This is the plain version, with the handful of terms worth knowing.

What is Git?

Git is version control software: a tool that keeps a complete history of every change to a set of files. Each saved change records what was altered, when, by whom, and why. Any earlier state of the project can be recovered. Nearly all professional software is developed with it.

A repository, or "repo", is a project's folder plus that history. It usually lives in two places: on the developer's computer, and on a hosting service such as GitHub, where the team shares it.

Think of it as a document with "track changes" that can never be turned off, where every revision since the first is kept and labeled.

Why does the history of your code matter?

The history of your code matters because it makes changes reversible and explainable. If a release breaks something, the previous version can be restored. If a strange piece of code raises a question, the history shows when it was added and why. Without history, both become guesswork.

It also makes a change of developer survivable. A new developer can read how the project evolved. Each recorded change, called a commit, carries a message:

a41c9e2  Fix quote form not sending on mobile Safari
7be03d1  Add Surprise and Glendale service pages
c92f0aa  Update business hours in footer

Those are invented examples, but that is what a history looks like: a readable log of what was done. A project with no history is a project where everything anyone learned along the way has been lost.

What is a branch?

A branch is a separate line of work inside a repository. A developer creates a branch to build a feature or fix a bug without touching the main version. The main version stays stable and releasable while the work is in progress, and several branches can exist at once.

The main branch represents what is live, or ready to be. Everything else happens off to the side. If the work on a branch turns out to be a bad idea, the branch is deleted and the main version never knew about it.

Branches are also what make previews possible. A hosting platform can build each branch into its own temporary site for review, as described in staging vs production.

What is a pull request?

A pull request is a proposal to merge the changes on a branch into the main version. It shows exactly which lines were added and removed, gives others a place to review and comment, and runs automated checks. The change joins the main version only when it is approved.

A pull request is where quality control happens. On CoverageCobra, our marketplace for court appearance coverage, nothing merges until type checks, lint, tests, and a build have passed. That gate is attached to the merge step, which is why it cannot be forgotten. There is more in how software is tested before launch.

The path of a typical change:

  1. Create a branch from the main version.
  2. Make the change and record it as one or more commits.
  3. Open a pull request.
  4. Automated checks run.
  5. Someone reviews it.
  6. Merge into the main version.
  7. Release. On many setups the merge triggers the release automatically.

What do the common Git terms mean?

The common Git terms are repository, commit, branch, pull request, merge, and clone. Together they describe where code is kept, how changes are recorded, how work is separated, how it is reviewed, how it is combined, and how a full copy is made.

TermPlain meaning
RepositoryThe project's files and their full history
CommitOne recorded change, with a message
BranchA separate line of work
MainThe branch that represents the live or releasable version
Pull requestA proposal to merge a branch, with review and checks
MergeCombining a branch into another
CloneA complete copy of the repository, history included
RevertUndoing a specific commit

Why should you have access to the repository?

You should have access to the repository because it is the only complete form of the software you paid for. A live website can be copied only partially. The repository holds the source, the history, and often the release process. Without it, moving to a new developer may mean starting again.

We have worked without one. When we rebuilt the site for Charme and Sons, a Peoria handyman, nobody had the source for the original. We rebuilt it from the outside in. That was workable for a single page. For an application with years of business logic in it, it would not be.

What to ask for:

  1. An account you control. Ideally the repository sits in an organization your business owns, with the developer invited in.
  2. Admin access, not just permission to view.
  3. Confirmation that it is current. The repository should match what is live.
  4. The same for hosting and the domain. Code is one of several things to hold. See who owns your website.

You never have to open it. You only need to be able to hand it to someone.

Can a repository do more than store code?

A repository can also run work. Hosting services let a repository execute tasks on a schedule or whenever code changes, on machines the service provides. Tests, releases, and recurring jobs can all run this way, with their instructions stored and versioned alongside the code.

Our Docket Scraper works like this. It checks public court records on a schedule and reports what changed, and it runs on GitHub Actions, a free CI runner. There is no server to maintain. The schedule, the code, and the history of both live in one repository. For the general idea, see what a cron job is.

Frequently asked questions

Is Git the same as GitHub?

No. Git is the version control software itself. GitHub is one of several services that host Git repositories online and add tools for review and automation.

Do websites need Git, or only apps?

Any site built from code benefits from it, including small static sites. Sites built entirely inside a hosted builder or a WordPress admin screen often have no repository, and their history lives in backups instead.

Is my code public if it is on GitHub?

Only if the repository is set to public. Repositories can also be private, visible only to the accounts you invite. Ask your developer which setting yours has.

Is Git a backup?

It is a full copy of the code and its history, which protects against losing either. It does not usually contain your database or uploaded files, so those need their own backups. See how to back up a website.

What should I do if my developer will not give me access?

Raise it early, in writing, and check what your agreement says about who owns the code. Ask for the repository to be transferred to an account in your name, or for a full copy with its history. The longer it waits, the harder the conversation gets.

If you are not sure where your code lives or who controls it, ask us and we will help you find out.

Who wrote this

The Cobra Developers team. We are a software studio in Arizona that builds and runs its own products and builds websites, web apps, and automation for clients. This post draws on our work on CoverageCobra, Docket Scraper. Everything here comes from projects we shipped; see all 30 of them.

guest@cobra: ~