Lesson 3 of 110 of 7 steps

Lesson 3 · about 25 minutes

Keep every version, and undo in one step

Every change to your app gets saved, with a note saying what changed, in a private place online called GitHub. If something goes wrong after you put it live, you step back to the version before. Nothing is ever lost.

Git for history from day one, a private GitHub repository as the backup, and deploys that run from GitHub after the tests pass. Plus rollback when a release goes wrong.

Git from the first file, and a private GitHub repo as the backup. Deploys run from GitHub, through Workers Builds or GitHub Actions, after the tests pass, and wrangler rollback undoes a bad release. Once merging to main puts the app live, the agent asks before every merge.

How much have you built before?
This lesson's wording changes to match.
FreeYour code stays private
  1. Say "Nice one!" after 10 tapsToday, 14:02
  2. Bigger tap buttonYesterday
  3. Sprout icon for the home screenTue
  4. First versionMon

The green one is live. Try undoing a release.

What you'll make

  • Your app's history, saved off your computer
  • A note for every change, in plain words
  • Putting it live from GitHub, with tests first
  • A one-step undo for a bad release

You'll need: the app from lesson 2 (or any app folder), and an email address for GitHub.

1

Why keep versions

Without history, a change that breaks something is hard to undo, and if your computer dies, so does your app's code. With history you can always see what changed, when, and go back.

Think of it as "track changes" for your whole app, with a backup copy kept safely online.

2

Every change saved with a note

Your agent saves a snapshot after every working change, called a commit, with a short note. With the skill installed it does this as it goes. Check it's on:

Say to your agent
Are you saving a commit after each change, with a plain-English note? Show me the last few.
A good reply looks like this
  • Say "Nice one!" after 10 taps
  • Bigger tap button
  • First version

Behind the scenes: git init once, then git commit per change. Secrets stay out (.dev.vars and .env are ignored).

3

Make a free GitHub account

Go to github.com/signup. The free account is all you need, and private repositories are included.

Then let your agent use it:

Say to your agent
Help me sign in to GitHub on this computer.

It uses a small tool called gh. A browser window opens with a short code to confirm. Like Cloudflare in lesson 2, you only do this once.

$ gh auth login
4

Put your app on GitHub, privately

Say to your agent
Put this app on a new private GitHub repository. Check the history for anything secret first.
$ gh repo create my-first-app --private --source=. --push
my-first-appPrivate
Say "Nice one!" after 10 taps 2 min ago
Bigger tap button yesterday
First version Monday
You should see

Your app on github.com with a Private label, and your changes listed with their notes. Only you can see it unless you invite someone.

It found something secret in the history
Good, that's why it checks. Let it remove the secret from the history before pushing, and change that password or key anyway: treat it as seen.
5

Go live from GitHub

Now putting it live can happen from GitHub: every time your changes are merged, the tests run, and if they pass the app updates. There are two ways; your agent can set up either.

Simplest: Workers Builds

Connect the repository in Cloudflare's dashboard. No passwords to copy around.

More control: GitHub Actions

A small file in your app runs the tests, then puts it live with Cloudflare's own action.

Say to your agent
Set up deploys from GitHub so the tests run first. Pick the simplest option and explain what you did.
# .github/workflows/deploy.yml (excerpt)- run: npm test- uses: cloudflare/wrangler-action@v4 with: { apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}, accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}, command: deploy }

Token: Cloudflare → Account API tokens → 'Edit Cloudflare Workers', scoped to this account. Store both values with gh secret set.

6

Undo a release

If something's wrong after a release, step back to the one before. Try it in the demo at the top of this lesson.

Say to your agent
The last release broke something. Undo it.
$ npx wrangler rollback

Then fix the problem calmly and put it live again.

Does undo bring back deleted data?
No. Undo puts the app's code back, not the data in your database. If a release changed or lost data, ask your agent about restoring the database (lesson 4 covers backups).
7

Merging means going live

Once GitHub puts your app live, accepting a change on GitHub is putting it live. The skill knows this: it works on a separate copy, shows you screenshots, and asks before merging, every time.

Your safety net: history on GitHub, tests before every release, a yes from you, and undo if you need it.

Lesson 3 doneYou just kept every version safe on GitHub, with a one-step undo.
Next up · lesson 4, about 30 minutesGive your app a memory that works with no signal, and backups.

Did it work?

Tick these off. They're saved in this browser, so you can come back later.

  • My app is on GitHub as a private repository
  • I can see my changes listed there
  • Putting it live happens from GitHub (or I chose to keep doing it myself)
  • I know how to undo a release