LogicTrail
  • Trails
  • Check my app
  • Pricing
  • Sign in
  1. Trails
  2. /
  3. Working with your AI agent
  4. · 5 minutes · Pro

The commit that broke checkout

Checkout broke this morning. Since then you have also shipped discount codes, which work and which customers are already using.

This answers: How do I undo one commit but keep later changes? No coding needed. 3 quick decisions.

  • Supervising your AI
  • Keeping data safe
  • Debugging without panic

Checking your access…

How do I undo one commit but keep later changes?

Use git revert with the commit's hash: it adds a new commit that undoes just that change and keeps everything after it. To bring back a single file from before, use git restore --source=<hash> -- <file> and commit, after checking with git log -- <file> that no later commit changed it. Avoid git reset --hard on shared work, because it discards every commit after the point you choose.

Trail of the bug
  1. AI agent
  2. GitHub
  3. Browser

Breaks at GitHub: One commit broke checkout

How it works

Three ways to go back
git revert 9b7d3e0
  1. 3a2b1c4Launchkept
  2. 51f0c8aAdd order emailskept
  3. 9b7d3e0Redesign checkout (broke checkout)undone by a new commit
  4. e4c1a2fAdd discount codeskept
Revert adds a new commit that undoes the redesign. Everything after it, including discount codes, stays.

Why AI tools write this bug

When an AI change breaks something, the instinct is to ask for another fix; going back to a known-good commit is often faster and safer.

How to fix it

  1. Find the commit with git log --oneline.

3 more steps, and a prompt that checks your own app for this bug. Part of Pro.

Unlock

Common questions

What is the difference between git revert and git reset?
Revert adds a new commit that undoes an old one and keeps history. Reset moves the branch back and discards later commits.

Related scenarios

  • The agent that reset productionFree · 5 min
  • Approve this command?Free · 4 min
  • Back to yesterday's versionPro · 4 min

More on this trail

Working with your AI agent: Dangerous commands, fix loops, deleted tests, prompt injection and invented packages.

Want someone to look?

We check AI-built apps for this and three other common leaks, in plain English.

Check my app
Sign in

Sign in to walk this one

3 decisions, about 5 minutes, and a prompt to check your own app for the same problem.

Sign in No password. We email you a link.

How to fix it

  1. Find the commit with git log --oneline.

3 more steps, and a prompt that checks your own app for this bug. Part of Pro.

Unlock