Go from never having used a coding agent to working productively and safely with one. The learner should understand what an agent is and how it differs from a chat assistant. They should choose a tool, set up a protected first project, describe tasks the agent can do well, and follow and verify its work. They should recover from bad changes, manage context, and plan bigger changes. They should also use tests as the definition of done and run everyday workflows (bug fixes, features, writing tests, codebase exploration, scripts, small tools, refactors). Throughout, they should keep secrets and systems safe and keep their own understanding growing instead of outsourcing it.
Recovering from a bad change card 4 of 6

Back to the checkpoint, fully

builds on: Commit before every task: checkpoints, Undoing with git: discard, reset, revert, Recognising when the agent goes in circles
The agent's two commits sit on top of checkpoint `e51f0c2`. `git reset --hard` drops them and all uncommitted edits. The new helper file is untracked, so reset leaves it behind. `git clean -n` previews what would be deleted, and `-f` deletes it. Check the preview first, because `git clean -f` deletes your own untracked files too. When `git status --short` prints nothing, you are exactly at the checkpoint.
$ git log --oneline -3
9c1e7aa fix export again
4b2d810 add CSV export
e51f0c2 before CSV export
$ git reset --hard e51f0c2
HEAD is now at e51f0c2 before CSV export
$ git status --short
?? src/export_utils.py
$ git clean -n
Would remove src/export_utils.py
$ git clean -f
Removing src/export_utils.py
$ git status --short
Terms on this card
checkpoint
A commit (or tool snapshot) made right before a task, so you can return to that exact known-good state.
uncommitted
Changes to files that exist on disk but are not yet saved in any git commit.
untracked
A file git has never recorded in a commit, such as a brand-new file. `git status --short` marks it with `??`.
git status
Command that lists files changed since the last commit, plus untracked files. `--short` shows one line per file: ` M` modified, `??` untracked.
git reset --hard
Command that moves your project back to a given commit, permanently discarding later commits and all uncommitted edits to tracked files.
Learn this step by step on Bytewise
Lesson goal: Given a broken state, choose the right recovery: discard uncommitted edits, return to the last checkpoint, or revert a specific commit. Then restart with a better prompt instead of piling fixes onto a bad attempt. · the whole lesson