How Software Development ChangedLesson 41 of 87

Contents

How Software Development Changed

Lesson 41 of 87. Sign in to keep your place.

Module 5 · The working loop

Git is what makes speed safe

9 min read

Fast generation is only safe when reversal is instant

The entire argument for working in small steps rests on one property: being wrong must be cheap. Git is where that property comes from, and most people use perhaps a fifth of what it offers.

The operations below are the ones that turn a bad hour into a lost fifteen minutes. Learn them once and the anxiety about accepting a large generated change mostly goes away, because you can always get back.

Commit far more often than feels reasonable

A commit is not a publication. It is a save point, and it costs nothing.

Bash
git commit -am "wip: currency column added, tests green"

Commit after every step that runs. Ten commits in an afternoon is normal and correct. You clean them up before the change goes anywhere:

Bash
git rebase -i main        # squash, reorder, reword
# or, if the history is a mess and the end state is right:
git reset --soft main && git commit   # one clean commit, same content

That second line is the one people do not know. It keeps every change in your working tree, discards the messy history, and lets you write one honest commit message. It converts “my history is embarrassing” from a problem into a non-event.

Stage in pieces, so you review your own change

Bash
git add -p

This walks you through the diff hunk by hunk and asks whether to stage each one. It is the cheapest self-review that exists, it takes ninety seconds, and it is the moment you notice the debug print, the commented-out line, the unrelated formatting change and the TODO you meant to resolve.

With generated changes it does more work than it used to, because you are frequently seeing lines for the first time. s splits a hunk into smaller ones; e lets you edit exactly what gets staged.

Work on two things at once without stashing

Bash
git worktree add ../myrepo-hotfix main

A second working directory on the same repository, with its own branch, its own files, and no stashing. Your half-finished experiment stays exactly where it is while you fix the urgent thing next door.

This matters more when running agentic tools, because you can let one work in one worktree while you work in another without your editor and its edits colliding. One caveat that catches people out: dependencies are not shared, so you may need to install them in the new tree, and on some toolchains a symlinked node_modules breaks the bundler: copy it rather than linking.

Find the commit that broke it, automatically

Bash
git bisect start HEAD v2.4.0
git bisect run pytest tests/test_billing.py::test_total

Git performs a binary search over history, running your command at each step, and tells you the exact commit that introduced the failure. Over a thousand commits that is ten runs.

This is the single most underused command in git, and it deserves a mention in a course about generated code specifically. When a repository accumulates change faster than anyone reads it, working backwards from a symptom to a cause by reasoning becomes harder, and a mechanical search over history does not care how the commits were produced.

The requirement is that you can decide pass or fail with one command. Which is another argument for the fast test suite from the previous module.

Undo, without losing anything

Bash
git reset --hard HEAD~1     # discard the last commit's changes
git revert <sha>            # a new commit undoing an old one — safe on shared branches
git restore --source=HEAD~3 path/to/file.py   # one file, from three commits ago
git reflog                  # everything HEAD has pointed at, for ~90 days

git reflog is the safety net under the safety net. Almost everything people believe they have permanently destroyed is sitting in the reflog:

Bash
git reflog
# ... 4a3f21b HEAD@{7}: commit: the work you thought you lost
git reset --hard 4a3f21b

A hard reset, a bad rebase, a deleted branch, an amended commit: all recoverable, for about ninety days, provided you have not run garbage collection. Knowing this changes how boldly you can operate.

The rule that ties it together

Never let an agentic tool run on a dirty tree.

Commit or stash first, always. When the working tree is clean, git diff shows precisely what the tool did and nothing else, git checkout . undoes all of it in one keystroke, and there is no possibility of your own uncommitted work being mixed into a change you are about to reject.

That is one habit, it costs three seconds, and it is what converts a tool that edits your files from something you have to trust into something you can check.

Every lesson here is open. Your progress is recorded once you pass the AI at Work exam.

Check your understanding

A developer lets an agentic tool make changes across twelve files while they had uncommitted work in progress. The result is mostly wrong. Why is this situation much worse than it would have been on a clean tree?

Pick the one you would defend. Your answer stays private.

Next lesson · 10 minConfining an agent

Stuck on something?Ask Larissa, your AI tutor

How to cite: Addaly (2026) ‘Git is what makes speed safe’, in How Software Development Changed. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/how-software-changed/git-as-a-safety-net (Accessed: 13 October 2026).