Skip to content

Under the hood

What is Git? Save points for your code, explained simply

Git records every version of your code so you can undo mistakes, try ideas safely and work with others. A simple explanation of commits, branches and GitHub.

By the GenKid team · · Updated · Facts checked · 5 min read

Key takeaways

  • Git is a version control system: it records snapshots of your project over time so you can go back to any earlier version.
  • A commit is a saved snapshot with a short message describing what changed.
  • Branches let you try ideas without breaking the working version.
  • GitHub is a website for storing Git projects online and collaborating; Git itself is the tool.
  • Version control is essential when working with AI: it lets you undo any AI change completely.

What is Git?

Git is a free, open-source version control system: a tool that records snapshots of your project as you work, so you can see what changed, go back to any earlier version and try ideas without losing the version that works.

Imagine you're building a game. It works. Then you add a new feature, and suddenly nothing works — and you can't remember exactly what you changed. Or you want to try a risky idea without wrecking the version that works.

Version control solves this. The Pro Git book describes it as a system that records changes to files over time so you can recall specific versions later. Git is a widely used version control system, and it's the one that services like GitHub are built around.

Commits: save points

The main idea in Git is the commit. A commit is a snapshot of your whole project at a moment in time, plus a short message saying what changed:

  • "Add score counter"
  • "Fix bug where score didn't reset"
  • "Make buttons bigger on phones"

Think of commits as save points in a video game. If something goes wrong, you can go back to the last one that worked. You can also compare any two save points to see exactly what changed — which is often the fastest way to find a bug: if it worked at one commit and not the next, the bug is in what changed between them.

Branches: safe places to experiment

A branch is a separate line of work. The main branch holds the working version. When you want to try something new, you create a branch, make your changes there and test them. If it works, you merge it into main. If it doesn't, you throw the branch away and main is untouched.

main:     ●──●──●───────────●  (merge)
                 \         /
feature:          ●──●──●─

Professional teams use branches for almost every change, and review them before merging using pull requests.

Git vs GitHub

People often mix these up:

GitGitHub
What it isA version control toolA website and service for hosting Git projects
Where it runsOn your computer (or a server)Online
What it doesRecords commits, branches and historyStores projects, enables collaboration, pull requests and reviews

Git is distributed: every copy of a project contains its full history, so you can work offline and still have every save point. GitHub is one of several services that host Git projects online. When we checked in November 2026, GitHub's terms required users to be at least 13, or older in some countries — see why developer tools have age limits. Because every copy holds the full history, your project isn't locked into one service: you can move it to another host and keep every save point (see how to avoid tool lock-in).

Why Git matters even more with AI

AI coding tools and agents can change many files at once. Sometimes those changes are great; sometimes they break things in ways that are hard to spot. Git gives you a safety net:

  • Commit before asking the AI for a change, so you can return to a known good state.
  • Look at the diff after the AI's change to see exactly what it did. See how to check code an AI wrote.
  • Undo completely if the change is wrong.
  • Keep AI experiments on branches until you're sure they work.

Developers who work with AI coding agents rely on this constantly. Git is also how many websites get online: some hosting services can publish a new version of a site automatically each time you push a commit (see what web hosting is).

Worked example: undoing an AI change that broke your game

Say you're making a space game. You commit after each working step. Then you ask an AI tool to "add a shield power-up", and afterwards the score stops counting. Here's how Git gets you out of trouble.

First, look at the history. git log --oneline lists your commits, newest first:

c4e91a2 Add shield power-up (AI change)
7b2d0f5 Fix score not resetting on Play again
a19e3c8 Add score counter

Next, see exactly what the AI changed. git diff 7b2d0f5 c4e91a2 shows every line added (+) and removed (-) between the last good commit and the AI's one. Reading it, you might spot that the AI renamed score to points in one place but not the others.

Then choose:

  • Fix it: change the one line yourself and commit again, with a message like "Fix score after shield change".
  • Undo it: git revert c4e91a2 makes a new commit that reverses the AI's change, so you're back to a working game, and the history still shows what happened.

The habit that made this easy was committing before asking the AI. Without that save point, you'd be hunting through the whole project for what changed.

A few terms you'll hear

  • Repository (repo) — a project tracked by Git, including its history.
  • Clone — copy a repository to your computer.
  • Commit — save a snapshot with a message.
  • Push — send your commits to an online copy, like GitHub.
  • Pull — get the latest commits from the online copy.
  • Merge — combine one branch into another.

Learning Git

Git has a reputation for being confusing, partly because of its command-line interface. The ideas, though, are simple: save points, history, branches. Children can learn the concepts long before they use the commands.

In GenKid, every change in the Build with AI workspace is saved and can be undone — the same idea as Git, in a child-friendly form. At Level 3, the Git & GitHub course covers commits, branches, pull requests and code review in a practice Git sandbox, with no GitHub account needed. See the pathway.

Frequently asked questions

Is Git hard to learn?

The ideas are simple; the commands take practice. Most beginners only need a handful at first — commit, log, diff and revert — and many tools show the same actions as buttons. Learning the ideas first (save points, history, branches) makes the commands much easier later.

Can Git get back a file I deleted?

Yes, if the file was in a commit. Git keeps every committed version, so you can restore a deleted file from an earlier commit. Changes you never committed aren't in Git's history, which is another reason to commit little and often.

Do I need Git for small projects?

It's useful even for small projects, because it lets you undo mistakes and see your progress. Many learning platforms build in a simpler version of the same idea.

What is a commit message?

A short description of what a commit changed, like "Fix score reset bug". Good messages make a project's history easy to understand.

Sources

  1. About version control (opens in a new tab) — Pro Git
  2. Git (opens in a new tab) — git-scm.com
  3. About pull requests (opens in a new tab) — GitHub Docs
  4. GitHub Terms of Service (opens in a new tab) — GitHub

How we write: GenKid articles are researched and drafted with the help of AI tools, then checked in a separate review step against the sources listed above before they are published, and re-checked when they are updated. Rules and products change, so check official pages for your country before acting on anything here. This article is general information, not legal advice. Spotted a mistake? Email hello@genkid.app.