Learn Claude Code by Building DevPulse · Chapter 4

Undo, and git

Claude changed a lot at once and you do not like it, so how do you get your old project back? By the end of this chapter, you will have tried rewind, seen where it stops, and put DevPulse under git with two commits.

One sitting~8 min read, ~20 min to build along
You start fromchapter 3's DevPulse, with CLAUDE.md
You builda git history: two commits
Chapter 4 of 15undo, and keep a history
Goes with Episode 4"How do I undo what Claude Code just did?". The video is being made. This page teaches the same steps, at your own pace.
In a hurry?Jump to the quick reference: every command and key in this chapter, what it does, and when to use it.
Every prompt, ready to copyThis chapter's prompts and commands, each with a Copy button. Type them yourself first; copy if you are stuck or behind.
Where you areDevPulse with a server, two views, an edit button and a CLAUDE.md, from chapter 3.

A big change you did not want

So far every change was small. Now ask for a big one, in four words.

Type this into Claude CodeGive DevPulse a modern makeover.
Claude's summary of the makeover: a gradient logo tile, an indigo-to-violet accent, pill-shaped tabs, rounder cards with soft shadows, highlighted rows and animated bars. Worked for 40s.
40 seconds later: a new logo, new colours, new shapes, new motion. A lot at once.
Two versions of DevPulse side by side: on the left the plain page from chapter 3, on the right the makeover with a purple logo tile, a glow and pill-shaped tabs.
Left, before. Right, after. Say you do not like it. It is not ours any more.
The question for this chapter

How do you get your project back exactly as it was, and how do you never lose a version you liked?

First, see what changed

Before undoing, look. Claude Code has a command that shows every change.

Type this into Claude Code/diff
/diff: The diff panel shows git changes. The current directory isn't in a git repository.
It cannot. /diff needs git, and our project has none yet. Remember this line; we fix it below.

Rewind, and where it stops

We met rewind in chapter 3. Press Esc twice and pick the message before the makeover.

Rewind: Restore the code and/or conversation to the point before… Give DevPulse a modern makeover. 2 files changed +177 -2.
Rewind knows its own size: 2 files changed, +177 −2. Even without git, it can count.
Confirm: The code will be restored +2 -177 in style.css and index.html. Options: Restore code and conversation, Restore conversation, Restore code, Summarize from here, Summarize up to here. Warning: Restored files go back whole, losing later changes by anyone. Bash changes to other files are not undone.
Choose Restore code and conversation. Read the warning at the bottom first: Bash changes to other files are not undone.

Now refresh the page.

DevPulse after the rewind: the logo tile is gone, but the purple glow and the pill-shaped tabs are still there.
Half back. The logo tile is gone. The glow and the pill tabs stayed.

Why? Look at how Claude worked. It changed the header with its edit tool. But it put most of the new style in with a shell command.

During the makeover: Running a PowerShell command that reads a scratchpad style.css and writes it into index.html.
The makeover went in partly through a shell command. Rewind tracks Claude's edit tool, not commands.

So rewind is a good undo for Claude's own edits. It is not a safety net for the whole project. I had a copy of the old index.html, so I put it back by hand. Without a copy, you would ask Claude to repair it, and hope.

That copy should not depend on luck. That is what git is for.

Keep every version with git

Git keeps a saved copy of your project each time you say "this works". Each saved copy is called a commit. You do not need to know the git commands yet. Ask Claude.

Type this into Claude Code, as one lineSet up git for this project. Keep data/tasks.json and Python caches out of git, and commit what we have.
Git is set up on branch main, and the first commit (897003a, Initial commit) has .gitignore, CLAUDE.md, index.html, server.py and test_server.py. .gitignore excludes data/tasks.json, __pycache__/ and *.pyc. I also ignored .claude/settings.local.json, which you didn't ask for.
The first commit, and a .gitignore: the list of files git must never save. Your tasks stay private. Note the honest line: which you didn't ask for.
Careful here

Git needs your name and email for every commit. If Claude says they are not set, run these two lines once, with your own details.

Type this in PowerShell or Terminal, oncegit config --global user.name "Your Name" git config --global user.email "you@example.com"

Commit with one command: a plugin

Committing well means a good message every time. Anthropic publishes a free plugin for that. Plugins add ready-made commands to Claude Code.

Type this into Claude Code, then search for commit-commands/plugin
The plugin manager, Discover tab, search box with commit-commands; result: commit-commands, Anthropic Directory, 178.5K installs, Streamline your git workflow with simple commands for committing.
The Discover tab. Press Enter on commit-commands to see its details.
Plugin details: commit-commands from claude-plugins-official, by Anthropic, a warning to trust a plugin before installing, and the options Install for you (user scope), Install for all collaborators on this repository (project scope), Install for you in this repo only (local scope).
Check who made it, read the warning, then choose Install for you (user scope).

Now make one small change, then commit it.

Type these into Claude Code, one at a timeShow today's total time in the browser tab title, like "DevPulse - 2 h 50 min". /commit-commands:commit
Typing /commit shows three plugin commands: commit-commands:commit (Create a git commit), commit-commands:clean_gone, commit-commands:commit-push-pr.
Type /commit and the plugin's three commands appear. We use the first.
Committed 8ea96ee: Show today's total in tab title. Then ! git log --oneline lists 8ea96ee Show today's total in tab title, and 897003a Initial commit.
A short message, as chapter 3's memory asked. ! git log --oneline shows our two commits. The grey line is only a suggestion.

What git costs

Git only keeps what you commit. A change you never committed is as unsafe as before. So commit each time something works, in small steps.

And a commit says the code runs. It does not say the code is right. In chapter 5 the streak looks right, passes our eyes, and is still wrong.

Quick reference

The prompts from this chapter, ready to copy: every prompt, chapter 4.

Command or keyWhat it doesUse it when
/diffShows what changed since the last commitYou want to see what Claude touched (needs git)
Esc EscRewinds to an earlier message: code, conversation or bothYou want to undo Claude's last steps
Restore code and conversationPuts files and the chat back as they wereBoth the change and the talk about it should go
Set up git for this project …Claude runs git init, writes .gitignore and makes the first commitYour project has no history yet
/pluginOpens the plugin manager: discover, install, manageYou want a ready-made set of commands
/commit-commands:commitWrites a commit message and commits your changesA change is done and works
! git log --onelineLists your commits, newest firstYou want to see your history

References

Where each command and behaviour on this page comes from. Every screenshot is from our own recording on 29 Oct 2026, Claude Code 2.1.312.

  1. Anthropic · Checkpointing Esc Esc rewinds code and conversation; changes made by shell commands are not tracked, so they are not undone. https://code.claude.com/docs/en/checkpointing
  2. Anthropic · Discover and install plugins /plugin, the official marketplace claude-plugins-official, and install scopes. https://code.claude.com/docs/en/discover-plugins
  3. Git · git-scm.com, the Git documentation What a commit, git log and .gitignore are. https://git-scm.com/doc
  4. My own recording · 29 Oct 2026, Windows 11 Rewind undid the edit-tool changes but not the shell command, so half the makeover stayed.