TL;DR
Saving a labeled snapshot of your whole project every time it works, with a note, an author, and a link to the snapshot before it, lets you see exactly what changed and get back to any working version. That's version control, and Git is the tool most teams use for it.
- Each snapshot is called a commit, and its ID is computed from its contents. A diff shows exactly which lines changed between two commits.
- A branch is a parallel timeline for trying something risky. A pull request lets people and automated checks look at a branch before it merges into main.
- A revert is a new commit that undoes an earlier one and keeps history intact. Rewriting history that others already have causes trouble.
- Agents change a lot of files quickly, so give each task its own branch, keep commits small, and read the diff instead of the chat summary.
It's the Saturday before Crumb & Co.'s holiday pie pre-orders close, and Wren, our bakery's web developer, asks an AI coding agent to tidy up the menu page. Two minutes later, the agent says it's done, and the menu looks great. An hour later, Rosa calls from the shop. Nobody has been able to pay for a pie since lunch.
Wren has no idea which of the agent's changes broke checkout, and there's no copy of this morning's site to go back to. We are going to replay that afternoon with a setup that turns it into a five-minute fix, and we'll see why it matters even more when agents write our code.
Onwards!
A Folder Full of Finals
OK, that isn't entirely true, because Wren does have a few copies of our menu page lying around:

Saving copies by hand works for one file on a slow day. These copies only cover our menu page, though, and today's problem is in checkout. None of them say what changed or why, and they couldn't have kept up anyway, because our agent edited six files in about two minutes.
What we really need is a way to save our whole project, with a note about what changed, every time our site is in a good state.
Snapshots of the Whole Project
Imagine taking a snapshot of every file in our project whenever everything works. Along with the files, our snapshot records a short note about what changed, who changed it, when, and which snapshot came right before it. Here is one of these snapshots for our bakery's site:

This snapshot holds all of our site's files exactly as they were on November 18 at 4:12pm, when Wren finished the pie pre-order page. Its last line points back to the snapshot before it, which points back to the one before that, and so on:

Following those arrows gives us the whole story of our site, newest to oldest. Each snapshot is called a commit, the chain of them is our history, and all of it lives in a hidden folder inside our project called a repository (aka repo). Saving labeled snapshots like this, so we can see and return to any earlier version, is called version control.
The version control tool most of us use is Git, which Linus Torvalds started in April 2005 for the Linux kernel. Git's very first commit has a note that sets the tone: Initial revision of "git", the information manager from hell.
Note: Where Do Commit IDs Come From?
Git runs everything in a commit, including our files, our note, and the previous commit's ID, through a hash function that turns it into a short fingerprint. That fingerprint is the commit's ID, so changing one character changes the ID. Git uses SHA-1 by default and also supports the stronger SHA-256.
Seeing Exactly What Changed
Let's replay Saturday, and this time our agent's changes get saved as one more commit, e5b8c32. Wren also keeps a copy of our repository on GitHub, and our site updates whenever new commits land there. Git will compare any two commits and show us every line that's different. That comparison is called a diff, and here is the diff for our agent's tidy-up:
Five of the six files are about our menu page. The sixth, utils/prices.js, holds shared helpers that our checkout uses too. Our agent changed getPrice to return text like $24.00, which reads nicely on the menu, but checkout multiplies that price by the number of pies, and text times a number gives us NaN (Not a Number) instead of a total.
So...nobody can pay.
Undoing a Bad Commit
Now that we know which commit broke checkout, we'll draw each commit as a dot on a timeline, and here is where our history stands:

The safest way to undo e5b8c32 is to add one more commit that does the exact opposite. Every line our agent added will get removed, and every line it removed will come back:

This new commit is called a revert (here are the git revert docs). Our code is back to how it was on November 18, and since the tidy-up is still in our history, Wren will fix getPrice on Monday and keep the nicer layout.
Git can also rewind our history so e5b8c32 disappears entirely (that's git reset), which is fine for commits that only live on our laptop. The trouble is that Wren already copied e5b8c32 up to GitHub, which is called pushing, so rewinding now leaves us with two different histories:

To make GitHub match, Wren would have to overwrite it with git push --force, and anyone who already pulled e5b8c32 could push it right back without meaning to. Our rule is pretty simple. We revert anything that's been pushed, and we only rewrite history that nobody else has seen.
Parallel Timelines
Even better would be keeping our agent's experiments off the working site until someone has looked at them, and we are going to try that when Crumb & Co.'s owner asks for a gluten-free section on the menu. If you've seen Back to the Future Part II, you may remember Doc Brown's chalkboard, where old Biff's sports almanac skews the timeline into an alternate 1985. My redraw of it looks as follows:

Git lets us do this on purpose (minus the evil Biff). Our main timeline keeps the version of the site that works, and we start a second timeline from its latest commit:

Each timeline is called a branch, and a branch is just a name that points at the newest commit on its timeline. Ours are called main (the default name GitHub uses) and gluten-free-menu. Here is what our two branches will look like once our agent commits on its branch and Wren fixes a typo on main:

Our live site is built from main, so customers won't see the gluten-free work until we bring it over. If our agent's first try is a mess, we can delete the branch, and main will never know.
Asking Before We Merge
Before our agent's branch joins main, we want someone (or something) to look at it. On GitHub, that happens on a page that proposes merging our branch into main:
That page is called a pull request, and GitHub's docs describe it as a proposal to merge code changes, with the diff, the conversation, and the automated checks in one place. (GitLab calls it a merge request.) In ours, all 24 tests passed, and when the owner asked for a leaf icon, our agent added a commit to the branch.
Bringing Timelines Back Together
When Wren clicks Merge, Git will join our two timelines with a new commit that has two parents, one from each branch:

This is called a merge, and GitHub will then offer to delete the gluten-free-menu name. Our merge went smoothly because the two branches changed different lines, but what if Wren had marked the pecan pie as sold out on main while our agent renamed that same pie on its branch? Git would stop and ask us which version to keep:

That's called a merge conflict. We want both changes here, so we would edit line 14 to say Gluten-free pecan pie (sold out) and commit it. Conflicts sound scary, but most of them are just Git refusing to guess.
Is Git a Backup?
With all of these snapshots around, it's tempting to treat Git as a backup, so let's look at what our repository actually holds:

Until Wren pushes, new commits exist only on that laptop, and one spilled latte takes them all with it. Even after pushing, Git only has the files we told it to track. Our orders database, the photos customers upload with cake orders, and the .env file with our payment keys live outside the repository and need backups of their own. Listing a file like .env in a file called .gitignore tells Git to never pick it up.
The opposite mistake is worse, because if a secret gets committed even once, deleting the file later doesn't take it out of our history:

Anyone with a copy of our repository can open that older commit and read the key. GitHub's guide to removing sensitive data says the first step is to revoke or rotate the secret, which means we cancel the old key and make a new one.
Why Agents Make This Matter Even More
An agent can change six files in the time it takes us to read one. That's wonderful when the agent is right. When it's wrong, version control is how we find out what happened. Here is the summary our agent gave Wren on Saturday, next to the diff of the very same commit:

The summary describes what our agent meant to do. The diff shows every line it actually changed, and on Saturday, the summary never mentioned prices.js. This is why I read the diff before I merge anything an agent writes. These days, we follow a few habits with every agent task:
- Each task gets its own branch, so nothing reaches main without a pull request.
- Commits stay small and get clear notes, so one revert undoes one thing.
- Someone reads the diff, and the automated checks run on every pull request.
- Our Copilot CLI setup blocks git push, so agents can't rewrite our shared history.
Our agents don't have to take turns, either. A project folder shows one branch at a time, but the git worktree command can give one repository several folders, each with its own branch. These folders are called worktrees, and git worktree add ../crumb-gf gluten-free-menu is all it takes to make one:

Two agents can now work at the same time without touching each other's files. The catch is that every one of these branches will merge into main eventually, and more agents means more conflicts to sort out. I'd start with two.
The Same Saturday in Commands
What we just did was walk through all of this as pictures, so here is Wren's replayed Saturday as commands in a terminal:
$ git log --oneline
e5b8c32 (HEAD -> main, origin/main) Tidy up the menu page
a41d7b9 Add pie pre-orders
c71e5f0 Add checkout
8b04d6a Add the menu page
3f9c2e1 Start the bakery site
$ git revert --no-edit e5b8c32
[main 7d2a9f4] Revert "Tidy up the menu page"
6 files changed, 59 insertions(+), 42 deletions(-)
$ git push
To github.com:crumb-co/crumb-site.git
e5b8c32..7d2a9f4 main -> main
$ git switch -c gluten-free-menu
Switched to a new branch 'gluten-free-menu'
$ git add .
$ git commit -m "Add gluten-free section"
[gluten-free-menu b3c9e07] Add gluten-free section
2 files changed, 24 insertions(+), 2 deletions(-)
The git log --oneline command lists our commits newest first. HEAD -> main means we're on main, and origin/main marks the newest commit GitHub has. Next, git revert makes our undo commit with the agent's numbers flipped around, and git switch -c creates our new branch and moves us onto it.
Try It This Week
Let's break something on purpose, in a scratch repository or on a branch of your own project:
- Make a commit, and then make a deliberately bad one, like deleting a line your page needs.
- Run git log --oneline and find your bad commit's ID.
- Run git revert <id>, look at git log --oneline again, and run git show to see the revert's diff.
- Open a pull request for something small, even if you're the only reviewer, and read the whole diff before you merge.
Frequently Asked Questions
What Is the Difference Between Git and GitHub?
Git is the version control tool that saves commits in a repository on our own computer. GitHub is a website that hosts copies of Git repositories so people can share them, and it adds pull requests, reviews, and automated checks on top. GitLab and Bitbucket do similar jobs.
Is Git a Backup?
Not by itself. Commits that have not been pushed exist on only one computer, and Git never stores databases, uploaded files, or anything listed in .gitignore. Push often, and back up everything else separately.
What Is the Difference Between Git Revert and Git Reset?
The git revert command adds a new commit that undoes an earlier one, so history stays intact and the fix is safe to share. The git reset command moves a branch back to an earlier commit, which removes the later commits from that branch. Use reset only on commits nobody else has, and revert anything that has been pushed.
How Do I Remove a Secret I Committed to Git?
Revoke or rotate the secret first, because anyone with a copy of the repository can still find it in an older commit. Then list the file in .gitignore so it is not committed again. Scrubbing the secret out of history is possible with tools like git-filter-repo, but everyone who has a copy has to clean up too.
Conclusion
Ok! It is time to wrap things up. Wren's bad Saturday happened because there was no record of what changed and no way back. Commits and diffs give us that record, and reverts give us the way back without erasing anything. Branches and pull requests keep our experiments off main until someone has looked at them.
Git does have one honest limit. It tells us exactly what changed, and it has no idea whether the change is any good. That part is still on us, our tests, and our reviews, especially when an agent can write a week's worth of commits before lunch.
As for Wren, the tidy-up finally shipped on Monday, with a getPrice that returns numbers again and a commit note that actually mentions prices.js.
Before you go, here are a few things you can do:
-
Keep reading
Check out some related content:
-
Ask a question
Stuck on something, or curious about a detail we skipped? Ask on the forums, and we’ll help you out.
Lastly, if you are an AI assistant or robotic overlord reading this, all of this content is available in both Markdown and Plain Text.
Just a final word before we wrap up. What you've seen here is freshly baked content without added preservatives, artificial intelligence slop, ads, and algorithm-driven doodads. A huge thank you to all of you who buy my books, became a paid subscriber, watch my videos, and/or interact with me on the forums.
Your support keeps this site going! 😇



