The single most useful habit in this course
Before you ask an agent to do anything, your project should be committed and clean.
git status
If that says nothing to commit, working tree clean, you are safe. Whatever happens next
can be thrown away with one command.
If it lists changes, commit them first:
git add -A
git commit -m "describe what you just finished"
Why this matters more with agents than without
When you write code by hand, you change one thing at a time. You can remember what you
touched.
An agent can change nine files in twenty seconds. If you did not like the result, “undo” in
your editor will not save you, because the changes were not typed in your editor.
Git is the only real undo you have.
The three commands you actually need
git status # what has changed?
git diff # show me exactly what changed, line by line
git restore . # throw away all uncommitted changes, go back to my last commit
That third command is the one that makes you brave. Once you know a bad session costs you
nothing, you stop being careful in the wrong way — approving things quickly because
starting again feels expensive.
What a good commit looks like here
One commit per step from your list in Lesson 2.6. Not one commit per day, and not one
commit per file.
git commit -m "Step 3: page listing all cards"
Small commits mean that when something breaks in step 7, you can look back and see exactly
what step 6 changed.
The rule
Clean tree before you start. Commit after every step that works.
It feels slow for the first hour. Then it saves you an afternoon, and you stop noticing you
do it.
Try this before the next lesson
- In your Recall folder, run
git status. Make it clean. - Run
git log --oneline. You should see your Step 1 commit from Module 3. - Create a file, write anything in it, then run
git restore .. Watch it vanish. That is
what you are buying.