Module 5 · Page 1 of 5

Keep track of changes

AI agents can make many changes to your project in seconds. That is useful—until a change breaks something that used to work. Git helps you see what changed, save working versions, and recover from mistakes.

When the agent breaks something

Imagine you have built a coffee shop dashboard. The charts look good, the calculations are correct, and you are ready to add one more feature: comparing sales across months.

You ask your agent to build it. The agent edits a dozen files. The comparison works, but the original dashboard layout is now broken. You ask the agent to fix the layout, and another chart disappears. How do you get back to the version that worked?

One approach is to make copies of your project as you work:

coffee-dashboard/
coffee-dashboard-final/
coffee-dashboard-final-v2/
coffee-dashboard-final-v2-actually-final/

This becomes confusing quickly. Which version worked? What changed between them? And which one should you edit next?

Version control is a better approach. It keeps a history of changes to a project, so you can inspect what happened and return to an earlier version when needed.

Git and GitHub: what is the difference?

Git is a version control tool that tracks changes to files in a project. A project tracked by Git is called a repository (or repo).

GitHub is an online service where you can store Git repositories, share them, and collaborate with others. You can use Git on your own computer without GitHub.

Think about the difference this way:

  • Git is the project's version history—similar in spirit to version history in Google Docs, but for an entire collection of files.
  • GitHub is an online home for that project and its history, where you can also work with other people.

The basic workflow: inspect, save, recover

You do not need to memorize Git commands. Your coding agent can help perform them. But you should understand the following actions so you know what to ask for and what to check.

1. Inspect what changed

Git can tell you which files were modified and show the differences between versions. This is especially important when an agent edits many files at once.

2. Save a checkpoint (commit)

A commit is a named checkpoint in your project's history. It records changes to the files Git tracks. Good commit messages describe what changed, such as Fix sales calculations or Add monthly comparison chart.

A simple project history might look like this (newest first):

● Add monthly comparison chart
│
● Fix sales calculations       ← verified working version
│
● Create initial dashboard

If the monthly comparison introduces a problem, you can use the earlier checkpoint to understand or recover what worked. You do not have to reconstruct it from memory.

3. Recover carefully

Git can help you restore a prior file or undo a problematic change. Before restoring anything, check whether you have newer work that you want to keep. Some recovery commands can discard uncommitted changes.

Remember A commit saves a version of your project; it does not prove that the version works. Follow the verification habits from Module 4 before calling a checkpoint a working version.

Let the agent handle the commands

Rather than starting with a long list of commands, start by telling the agent what you are trying to accomplish.

Example 1: Before making a big change

Prompt
I'm about to add a new feature to this project.

Before changing anything:
1. Check whether this folder is already tracked by Git.
2. Show me any uncommitted changes.
3. Help me save the current working version as a commit.
4. Explain what will be included in the commit.

Do not discard or overwrite any existing work.

Example 2: After the agent makes changes

Prompt
Summarize what you changed in this project.

Tell me:
1. Which files were added, modified, or deleted
2. What changed in the main files
3. Whether any changes seem unrelated to my request
4. What I should test before saving a commit

Don't commit yet. Let me review the changes first.

Example 3: When something goes wrong

Prompt
The dashboard worked before the latest changes,
but now one of the charts is missing.

Compare the current files with the last known working
commit. Explain what likely caused the problem and
suggest ways to recover.

Do not reset, restore, or delete anything yet.
Ask for my approval before making destructive changes.

If you want to learn what the agent is doing, ask it to show you the Git commands it uses and explain them in plain language.

GitHub: keep a remote copy and collaborate

Your Git history can live entirely on your computer. Putting a repository on GitHub lets you keep a remote copy and share the project with teammates.

For example, you and a teammate could each work on different parts of the dashboard, then combine your changes. Git helps track the changes, although combining them sometimes requires resolving conflicts.

Important A Git commit is not automatically a cloud backup. Your local commits stay on your computer until you send them to a remote repository. Also, not every GitHub repository is private. Check your repository's visibility, and never commit passwords, API keys, or confidential information.

Exercise: save, break, recover

Use a small project you have already built (such as your coffee shop dashboard). Work with your coding agent to complete the following:

  1. Save: Ask the agent to check the Git status. If Git is not set up, ask it to initialize the repository. Review what will be tracked, then save a commit of the working project.
  2. Change: Ask the agent to make a visible change, such as updating the dashboard title or rearranging a chart. Inspect the changes, test that the dashboard still works, and commit.
  3. Break: Ask the agent to make an intentionally undesirable change, such as removing a chart. Do not commit this change.
  4. Recover: Ask the agent to show the difference from the last working commit and help you restore the missing chart without losing other work.

Afterwards, consider: What would recovering have looked like without Git? How did you know which version was safe to return to?

Rule of thumb Before a big change, save a checkpoint. After a successful change, verify it and save another. Ask the agent to explain changes before you approve them.
Next · Page 2 of 5
Share and deploy what you build
→