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 3 of 6

Pick the undo by what you're undoing

builds on: git status and reading a diff
- **One file, not committed:** `git restore <file>` puts it back as of the last commit. The edits are lost forever. - **All uncommitted edits:** `git reset --hard` puts every tracked file back to the last commit. The edits are lost forever. - **A commit already made:** `git revert <hash>` adds a new commit that cancels it. Nothing is lost. `HEAD` is git's name for your latest commit, so `git revert HEAD` cancels that one. Run `git status` and `git diff` first.
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.
tracked
A file git already knows about because it was included in an earlier commit or added with `git add`.
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.
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