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 6 of 6
Remember
builds on: git status and reading a diff
For uncommitted edits, use `git restore <file>` for one file or `git reset --hard` for all of them. Both delete those edits forever, so read `git diff` first. For a commit already made, use `git revert <hash>`. It adds an opposite commit and loses nothing.
Terms on this card
- commit
- A saved snapshot of your project's tracked files that git can always return to.
- uncommitted
- Changes in your files that are not yet saved in any commit. Git has no copy of them.
- git restore
- Puts a file back to how it was in the last commit, discarding its uncommitted edits permanently. If you already ran `git add` on the file, add `--staged --worktree` to go all the way back to the last commit.
- 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.
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