FirstPrompt
Masuk
Jalankan harimu dari terminalModul 1 · Satu terminal, dengan benar
Pelajaran 5 dari 6SebelumnyaBerikutnya
2:09

Video ini masih dalam bahasa Inggris. Versi bahasa Indonesia segera hadir.

Undo tanpa takut

GratisVideo 2:09

Kamu membaca sebagai tamu — progres hanya tersimpan di perangkat ini.

Daftar gratis untuk menyimpannya

By the end of this lesson you will have broken something on purpose and put it back, using two keys. You will also know the four things this undo does not cover, which is the more important half: an undo you trust too much is worse than no undo at all.

The reason people drive Claude Code one careful prompt at a time is fear. Not of the tool, but of the moment where it confidently rewrites six files and you cannot remember what three of them used to say.

That fear is reasonable and it is also solvable. Every prompt you send saves a checkpoint. You can go back to any of them.

Break something

Go back to the folder from lesson 1 and start a session.

The session you named in the sessions lesson. If you skipped that, run claude --resume and pick the one from lesson 1.
claude --resume morning-triage

Now ask for something you do not want:

6 menit baca
Pelajaran 5 dari 6

Modul 1 · Satu terminal, dengan benar

0/6
  1. 2:44Sepuluh menit sampai jadi sesuatu yang bisa kamu kirimVideo
  2. 2:29Berapa biaya sebenarnyaVideo
  3. 2:23Terminalmu bukan misteriVideo
  4. 2:19Sesi adalah satuan kerjaVideo
  5. 2:09Undo tanpa takutSedang diputar
  6. 1:35Rekap modul 1Video
Rewrite card.html completely as a dark-mode terminal aesthetic with a monospace font and no headings.

Let it finish. Open the page and look at it. Assume you hate it.

Put it back

Press Esc twice on an empty prompt. Not while you are mid-sentence: if there is text in the box, a double Esc clears the text instead, and saves your draft to history so Up gets it back. If the list does not open, type /rewind.

Same thing as pressing Esc twice on an empty prompt. Use whichever you remember.
/rewind

You get a list of checkpoints, one per prompt you sent, and six choices:

  • Restore code and conversation — everything goes back, files and chat both
  • Restore conversation — the chat rewinds, the files stay as they are
  • Restore code — the files rewind, the chat remembers what happened
  • Summarize from here — keep going, but compress everything after this point
  • Summarize up to here — keep going, but compress everything before it
  • Never mind — back out

The list opens with (current) selected, and pressing Enter there restores nothing. Press the up arrow to your dark-mode message (it shows the lines it changed), press Enter, then choose Restore code and conversation. Your dark-mode request comes back in the input box: press Ctrl+C to clear it. Open the page again. It is the one you liked.

The rewind menu listing checkpoints with the six restore options beneath
One checkpoint per prompt. The two code options only appear when that checkpoint actually changed tracked files.

The two code options only appear when that checkpoint changed files. A checkpoint where you only asked a question has nothing to restore.

Checkpoints are saved with the conversation, so this works after a resume too. Yesterday's mistake is still undoable this morning. The last 100 checkpoints in a session keep their file snapshots, and everything is deleted along with the session after 30 days.

What it does not cover

This is the half that matters, and it is why the official documentation says, in as many words, that this is not a replacement for version control. The restore screen says the same thing at the bottom: "Rewinding does not affect files edited manually or via bash."

Four things rewind cannot bring back:

  1. Files changed by a shell command. If Claude ran rm, mv or cp, those changes are not tracked and not reversible. This is the big one. A deleted file is deleted.
  2. Edits made by a subagent. You will meet subagents in module 4. Their changes are not restored by a rewind.
  3. Changes made outside the session. Your own edits in another editor, or edits from a second Claude session running at the same time, are invisible to it.
  4. Symlinked and hard-linked paths. These are skipped, and you get a note saying how many files were passed over.

So the honest rule for the rest of this course, and it becomes load-bearing the moment you have more than one session running:

Rewind is for the last ten minutes. Git is for everything else.

Commit before you start something ambitious. It costs one command and it is the only undo that covers all four of the cases above.

This folder is not a repository yet, and git add fails without it. Module 3 needs one anyway.
git init
git add -A
If git says it does not know who you are, set a name and email once: git config --global user.name "Your Name" and git config --global user.email you@example.com.
git commit -m 'before the rewrite'
Cek hasilnya
  • You asked for a change you did not want, and the file changed
  • A double Esc on an empty prompt opened the checkpoint list
  • Restoring code and conversation put the file back to the version you liked
  • You can name at least two things rewind will not undo
  • The folder is now a git repository with at least one commit in it
Masuk agar hasil kerjamu bisa dicek
Kalau kamu melihat Esc Esc just clears what I was typing

There was text in the prompt box. Clear it first, then press Esc twice on the empty box. Your cleared draft is not lost, press Up to bring it back. Or skip the keys entirely and type /rewind.

Kalau kamu melihat The rewind menu has no 'Restore code' option

That checkpoint did not change any tracked files, so there is no code to restore. Pick an earlier one, or check whether the change was made by a shell command rather than a file edit, in which case it was never tracked.

What you just learned

  • Every prompt creates a checkpoint. Esc twice on an empty box, or /rewind, opens the list.
  • You can restore code, the conversation, or both, and checkpoints survive resuming a session tomorrow.
  • Shell-command file changes, subagent edits and outside edits are not tracked and cannot be rewound.
  • Rewind covers the last few minutes. Git covers the rest, and one commit before ambitious work makes the difference.

Latihan

Coba ini di komputermu sendiri. Kursus ini berjalan di Claude Code, yang butuh paket Claude berbayar.

Buka di Claude
BerikutnyaRekap modul 1
Sebelumnya
Berikutnya
KursusJelajahi Jalankan harimu dari terminalPrompt packBuat Website Sendiri