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.
Undoing with git: discard, reset, revert card 5 of 6

Reverting yesterday's commit

builds on: git status and reading a diff
`git log --oneline` lists commits newest first. The commit `7d4e8a2 Rewrite date parsing` broke dates, but two good commits came after it. Run `git revert --no-edit 7d4e8a2`. Git adds a new commit that removes exactly those changes, and the later commits stay. `git log --oneline` now shows `Revert "Rewrite date parsing"` on top. Don't `git reset --hard` to an older commit, whether you name it by hash or as `HEAD~1` (the commit just before `HEAD`). Every commit after it is dropped, the good ones too.
Terms on this card
commit
A saved snapshot of your project's tracked files that git can always return to.
git reset --hard
Puts all tracked files back to the last commit, discarding every uncommitted edit permanently. Given a commit hash, it also drops all later commits.
git revert
Creates a new commit that undoes the changes of an earlier commit. The history is kept and nothing is lost.
--no-edit
Tells `git revert` to use its default commit message instead of opening a text editor.
hash
The short code that identifies a commit, like `7d4e8a2`, shown by `git log --oneline`.
Learn this step by step on Bytewise
Lesson goal: Choose the right undo. Discard uncommitted changes to files, return to the last commit, or revert a commit that is already made. Know which of these permanently loses work. · the whole lesson