Skip to content

Introduction to Version Control (Git)

Beginning of the lesson

Saving the Story of Your Code

A first look at version control and Git

Big Idea: When you build something on a computer, you can save every version of it, like a photo album of your work. A tool called version control remembers each saved step, lets you go back if something breaks, and lets many people build together without messing up each other's work.
By the end you will be able to:
  • say what version control is, in simple words,
  • explain what a commit and a project's history are,
  • describe the idea of a branch and why it keeps work safe,
  • say what Git is.

1. What is version control?

Version control is a way of saving the history of your work so you never lose it. Every time you finish a little piece, you save a snapshot. Later you can look back at every snapshot, or even jump back to an older one if you make a mistake.

Think of writing a story. You might write draft 1, then draft 2, then draft 3. What if draft 3 is worse and you want draft 2 back? If you kept every draft, that is easy. Version control keeps every draft of your code for you, automatically and neatly.

Programmers use it because code changes a lot. A working program can break with one small change. Version control lets you undo that change and get back the working version in seconds.

2. Commits: named snapshots

A commit is one saved snapshot of your project. It is like pressing "save" in a video game, but with a twist: you also write a short message that says what you changed. That way the history is easy to read later.

What you didA good commit message
Added a jumping cat"Add a cat that jumps when you press space"
Changed the colours"Make the background blue"
Fixed a bug"Fix the score that counted twice"

A commit remembers three things: what changed, who saved it, and when. So the history is like a diary of the project.

Continue this lesson on YourAIZone

The full lesson has the complete explanation, worked examples, common mistakes, tests with instant checking and an AI tutor. Start right away as a guest, or create an account to keep your progress.

In the full lesson

  • The complete explanation
  • Worked examples
  • Common mistakes and how to avoid them
  • Test questions: 15
  • AI tutor that answers questions about the topic
  • Progress tracking for students, parents and teachers