Skip to content
AI Newbie
Menu
Step 3 of 86 min read

Git part 1: save points you control

Newbie to Tech · Step 3 of 8 · about 5 minutes to read, 25 minutes to do Practice project: https://github.com/jazken/mood-habit-tracker · start from main · answer key: branch step-1. This is a solo lesson. No partner, no conflict. Works with any AI coding tool. Git terms were checked against the Pro Git book and GitHub Docs on 20 Oct 2026 (SGT).

Do this now (you can read the rest after)

Today you add a real feature, saving, and keep it as your first save point (a commit).

  1. Open your tool in the mood-habit-tracker folder. Make sure "ask me first" is on.
  2. Ask:
I'm new to Git. Run one command at a time.
Before each one, tell me in plain words what it does.
1. Show me the status.
2. Make a new branch called my-save and switch to it.
  1. Then ask for the feature, plan first:
Plan how to make index.html remember today's mood and habits
after a refresh. Use the browser's localStorage. No internet, no new files.
Also show a short list of saved days. Don't change anything yet.
  1. Read the plan. Say go. Read each diff, then approve.
  2. Test it: refresh the page. Tap a mood and a habit. Refresh again. Are your taps still there?
  3. Save it:
Show me the diff. Then commit index.html with the note
"Save each check-in in the browser". Then show me the history.

Check you did it: git log shows your commit, "Save each check-in in the browser". After a refresh, the page still shows today's taps.

Answer key: the step-1 branch is one finished version. Open https://github.com/jazken/mood-habit-tracker/tree/step-1 and look at its index.html. Yours won't match line for line. That's fine. What matters is that yours works. Don't push yet. You'll do that in Step 5.

Want warm-up practice first? Try the first 3 levels of Learn Git Branching (https://learngitbranching.js.org/). Nothing can break there.


Why this matters

In Step 2 you learned to undo AI changes. Git is the undo that works with every tool, and with your own edits too. It's also how teams share work, which is Step 4.

First, a picture (then the real thing)

You've probably used a shared document with version history: you can look back at older versions. Git is a bit like that, with two big differences:

  1. Nothing saves by itself. A shared document saves as you type. Git only saves when you (or your AI tool) make a commit.
  2. Everyone has a full copy. A shared document lives in one place online. With Git, everyone has the whole project and its history on their own computer.

Keep the picture in mind, but remember these two differences. They're the real mechanism.

The 3 big words

Repo (repository)

A repo is a project folder that Git keeps track of. Git keeps its notes in a hidden folder called .git. Don't edit that folder yourself.

Commit

A commit is a save point. It holds:

  • a snapshot of your files at that moment,
  • a short note (the commit message) saying what changed,
  • who made it, and when.

Saving takes two moves:

  1. Stage (git add): pick which changes go in the next save point.
  2. Commit (git commit -m "your note"): save them, with your note.

Good commit notes are short and say what changed: "Save each check-in in the browser", "Fix typo in title". Not "stuff" or "update".

Branch

A branch is a separate line of save points. The main line is usually called main. You can make a new branch, try something, and main stays safe. If you like the result, you merge it back. If you don't, you just leave the branch.

The 5 commands you'll see most

CommandWhat it doesSafe?
git statusShows what changed since the last save✅ Only looks
git diffShows the changes line by line (+ and −)✅ Only looks
git logShows the list of save points✅ Only looks
git addPicks changes for the next save✅ Easy to change
git commit -m "note"Makes the save point✅ Adds a save point and loses nothing

Two more you'll meet soon:

  • git switch -c my-save makes a new branch called "my-save" and moves you onto it.
  • git restore index.html throws away unsaved changes to that file. ⚠️ Those changes are gone for good, so ask first.

A good habit with AI tools

Commit before you ask for a big change. Then if the AI makes a mess, you can go back to your last save point. Ask your tool: "Show me what changed since my last commit, and help me undo it."

Read the diff before every commit. The diff is the truth. The AI's summary is only its description of what it did.

In your tool: Git help

  • Kiro: the Source Control view has a 🪄 button that writes a commit message from your changes. Read it and edit it before you commit. In chat, type #git diff to ask about your current changes.
  • Claude Code: you can ask it to run Git commands in chat. It treats the .git folder as protected, so it doesn't change it on its own without asking. The one exception is a "bypass permissions" mode, which you shouldn't use.
  • Antigravity: in the CLI, /diff opens a diff viewer for your workspace changes and commit history. You can leave comments on lines for the agent.
  • Codex: in its normal sandbox, the .git folder is read-only. So we expect Codex to ask your permission before it can commit. I haven't tested this myself, so watch for the prompt.

What is localStorage?

localStorage is a small notebook inside your browser, on this computer. A page can write notes in it and read them later. It stays after you close the page. It is not sent online. If you clear the site's data, or use another browser, the notes are gone.

See both versions (2 minutes)

Ask your tool:

Switch to main and tell me if index.html saves anything.
Then switch back to my-save.

Refresh the page each time. On main, the note says "Nothing is saved yet". On my-save, your days stay. You just saw the magic: two versions of your project, and both are safe.

A small Git quirk in this project: each step name, like step-1, is both a branch and a tag (a fixed bookmark). Even main has a tag. Git may say a name is "ambiguous". That's only a warning. Your own branch names, like my-save, don't have this problem.

Words from this step

WordWhat it means
RepoA project folder Git tracks
CommitA save point with a note
Commit messageThe short note on a save point
StagePick which changes go in the next commit
BranchA separate line of save points
MainThe usual name for the main branch
MergeJoin a branch's changes into another branch
localStorageThe browser's notebook on this computer

Go deeper

Next: Step 4, Git part 2: work together.

After you try it

Did this produce something you could use, and what did you have to correct?

Email a reply, or keep a note for yourself. The useful part is the correction — that is the skill, not the first draft.

Email hello@ainewbie.org

Get the AI Newbie Brief