Git commits: save points

Play this lesson

Goodbye, game_FINAL_v3.js

Kai and Remy's old project folder was full of copies: game_v2.js, game_FINAL.js, game_FINAL_v3.js. Nobody could say which one was really the latest.

Real developers use Git instead: a tool that keeps track of every change to every file. Linus Torvalds wrote it in 2005 to manage the code of Linux, and now almost every software team uses it.

A project that Git looks after is called a repository, or repo. It holds all the game's files plus their whole history.

Start a repo

Open a terminal (the window where you type commands) inside the game's folder and type:

git init

Git creates a hidden folder called .git. That's where it keeps every save point. Never edit or delete it: deleting .git deletes the whole history.

The first time you use Git on a computer, tell it who you are, so every save point carries your name:

git config --global user.name "Kai"
git config --global user.email "kai@example.com"

Commits are save points

A commit is a snapshot of the whole project at one moment. Every commit stores:

You decide when to commit, just like choosing when to save before a boss fight.

Bolt says: A good message starts with a verb (add, fix, change) and says what changed in about 50 characters or fewer.

Quick check

What is a commit?

  1. A snapshot of the project with a message about what changed
  2. A copy of the game you email to a friend
  3. A bug report from a player
Show the answer

A snapshot of the project with a message about what changed

A commit is a save point: a snapshot of every file, plus a message, a name, a time and a hash. You can always come back to it.

Three places for a change

Git moves every change through three places:

Bolt says: Why a waiting area? So you can commit the finished snail fix now, and keep your half-done shop changes out of it.

git status, your best friend

git status tells you where every change is. It sorts files into groups:

git add . stages every change in the folder at once. The dot means "this folder". It's quick, but run git status first so nothing unwanted sneaks in.

Read the status

Terminal
$ git statusOn branch mainChanges to be committed:        modified:   balance.json Changes not staged for commit:        modified:   shop.js

Remy now types git commit -m "Halve snail speed". What goes into the commit?

  1. Only balance.json
  2. Only shop.js
  3. Both files
Show the answer

Only balance.json

Only staged changes go into a commit. balance.json is under "Changes to be committed". shop.js changed but was never added, so it stays out until Remy runs git add shop.js.

Look back: diff and log

git diff shows changed lines you haven't staged yet: a minus for removed, a plus for added. git diff --staged shows what the next commit will hold.

git log --oneline lists the history, newest first, one commit per line:

a1b2c3d Halve snail speed
9f8e7d6 Add snail pest

In the prototype days, an AI change crashed the boss fight and there was no way back. With Git, the log shows the last commit that worked, and you can return to it.

Commit pick

balance.json
- "snailSpeed": 2,+ "snailSpeed": 1,

git diff shows Remy's change. Which commit message is best?

  1. "changes"
  2. "Halve snail pest speed in Garden Defense"
  3. "Fix the shop"
Show the answer

"Halve snail pest speed in Garden Defense"

It starts with a verb and says exactly what changed: snail speed went from 2 to 1. "Fix the shop" describes a different change, and "changes" tells nobody anything.

Only on your laptop

Commit every time a small change works. Small save points are easy to go back to.

But so far, every commit lives only inside the .git folder on one laptop. If that laptop breaks, the history is gone, and Remy can't get Kai's commits.

Bolt says: Next lesson: push, pull, fetch and clone, to share commits through GitHub.

Fact-checked 9 October 2026