Git commits: save points
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:
- exactly what changed in each file
- a short message saying what you did
- who made it and when
- a unique ID called a hash, like
a1b2c3d(the full one is 40 characters long)
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?
- A snapshot of the project with a message about what changed
- A copy of the game you email to a friend
- 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:
- Working folderYour files as they are right now, including changes Git hasn't saved yet.
- Staging areaA waiting area. git add balance.json puts that change here, ready for the next commit.
- Repositorygit commit -m "Halve snail speed" saves everything in the staging area as one commit.
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:
- Untracked files: new files Git has never saved.
- Changes not staged for commit: changed, but not added yet.
- Changes to be committed: added and ready.
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
1$ git status2On branch main3Changes to be committed:4 modified: balance.json5 6Changes not staged for commit:7 modified: shop.js
Remy now types git commit -m "Halve snail speed". What goes into the commit?
- Only balance.json
- Only shop.js
- 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 speed9f8e7d6 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
1- "snailSpeed": 2,2+ "snailSpeed": 1,
git diff shows Remy's change. Which commit message is best?
- "changes"
- "Halve snail pest speed in Garden Defense"
- "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
- Pro Git: A short history of Git git-scm.com
- Pro Git: Recording changes to the repository git-scm.com
- Pro Git: First-time Git setup git-scm.com
- Git: Upcoming breaking changes (SHA-256 planned for Git 3.0) git-scm.com