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.
Breaks at GitHub: One commit broke checkout
How it works
git revert 9b7d3e03a2b1c4Launchkept51f0c8aAdd order emailskept9b7d3e0Redesign checkout (broke checkout)undone by a new commite4c1a2fAdd discount codeskept
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
- Find the commit with git log --oneline.
3 more steps, and a prompt that checks your own app for this bug. Part of Pro.
UnlockCommon 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.