Module 3 · Your tool

Testing and fixing with AI, with versions saved in git

Lesson 9 of 12 9 min lesson Updated on October 30, 2026
Progress in the course75%

In this lesson

Everything will break at some point. The difference between panic and routine is knowing how to read the error and having somewhere to go back to.

An experienced programmer does not make fewer mistakes. They have a method: they read the error calmly and keep every version that worked.

Where the error shows up

You do not need to understand the message. You need to copy all of it.

The fix request

When I click "export" nothing happens. The console shows: TypeError: Cannot read properties of null (reading 'value') at index.html:87. What I did: I added 3 orders and clicked export. What I expected: to download a file with the 3 orders. Fix only this problem and explain in 2 lines what was wrong.

There are four ingredients: the symptom, the message pasted in, what you did and what you expected. Plus the limit "only this problem".

Tip

If the AI says "fixed" and the error is still there, do not repeat the request. Paste the current message and say the error is the same. On the third failed attempt, go back to a saved version.

Real example

The owner of a clothing store had a tool to keep track of exchanges. The "record" button stopped working after a layout adjustment. She opened the console, saw the error in red, pasted it into the conversation with the four ingredients, and in one minute it was solved. Before, she thought she "had broken everything".

Git, without the mystery

Git keeps the history of the project. Every time you "save a version" (a commit), it takes a snapshot of all the files, with a message from you. Everything stays on your computer, in a hidden folder called .git.

CommandWhat it does
git initStarts the history (once)
git add .Marks the changed files for the next snapshot
git commit -m "message"Takes the snapshot and stores it
git log --onelineLists the snapshots, one per line

The message is for you three months from now. "Tweaks" says nothing. "Fixes the export button that was not downloading the file" says it all. Make a commit for every small change that worked.

Careful

Create the .gitignore with .env in it BEFORE the first git add .. If the API key goes into a commit, the only safe way out is to revoke it and create another one. Deleting the file afterwards does not remove the key from the history.

What the pros know

Git almost never truly loses a commit. There is a record of your project's latest positions, the git reflog. By default, it keeps the entries for 90 days, and those of commits that were left "dangling" (for example, after a reset or after amending the last commit) for 30 days. If you went back and wiped out a good version by accident, run git reflog, find the commit in the list and go back to it. Just do not count on it after that period.

Going back

The scenario: you asked for a fix, the AI touched five places and now two buttons have stopped working. If you made one commit per fix, going back one version loses only that fix. If you made one commit per day, you lose the whole day. That is why the pace matters: small, frequent commits. To go back, ask the AI: "the last change broke the menu; take the project back to the last commit".

Practice · 10 min

  1. Ask the AI for a .gitignore for the project. Then run git init, git add . and git commit -m "first version".
  2. Cause an error on purpose (for example, delete a line from the file). Copy the message and ask for the fix with the four ingredients.
  3. When it works, make a commit with a clear message and run git log --oneline.
Deliverable: three errors fixed and three commits with clear messages in the history.

Summary

Sources

Read on October 30, 2026.

  1. Git. git-gc: gc.reflogExpire (90 days) and gc.reflogExpireUnreachable (30 days).

Lesson quiz

Three situations to apply what you learned.

Lesson 9 of 12

Before moving on to the next lesson

Put what you saw into practice. The boxes stay checked in this browser, so you can come back later.

Have a question about this lesson? The IV Help team answers personally on WhatsApp.

Ask on WhatsApp