Git as an undo button
Your app worked this morning. After two hours of AI changes nothing loads, and you can't remember what changed.
This answers: How do I undo AI changes with git? No coding needed. 3 quick decisions.
- Reading code
- Supervising your AI
- Debugging without panic
Step 1 of 3
What would have made this easy to undo?
How do I undo AI changes with git?
Commit each time your app works, so you have save points. When AI changes break something, use git log to find the last good commit and git diff to see what changed. Undo a bad commit with git revert, which adds an undo and keeps history. Avoid reset --hard and , which erase work.
Breaks at Your laptop: Hours of changes, no save point
Why AI tools write this bug
AI agents can change many files in one session without committing, so there's no save point to return to when something breaks.
How to fix it
- Commit before asking for a big change.
- Commit again as soon as it works.
- Use git diff to see what changed.
- Undo with git revert, not reset --hard.
Check your own app
Paste this into Lovable, Cursor or Claude Code:
Without changing anything, show me this project's last ten commits in plain English, any changes not yet committed, and whether the repository has a remote such as GitHub. Then suggest a simple habit for when I should commit while working with you.
Common questions
- What's the difference between git and GitHub?
- Git saves snapshots of your project on your computer. GitHub stores a copy online, so it's backed up and your hosting service can deploy it.