How do I roll back an AI change that broke my app?
Using version control first
If you commit before each AI session, the rollback is straightforward. Look at the recent history, find the last commit that worked and check it out in a new branch. Test the app there to confirm it runs before you go further.
If you did not commit, check whether your editor keeps a local history of files. That can help recover recent versions, though it is less reliable than Git for larger changes. Mark the good version with a tag so it is easy to find later.
Reverting only the broken part
A full rollback can erase useful work from the same session. Compare the two versions file by file to see exactly what changed. Restore only the broken file or function, then rerun the tests. Keep a note of which commit marked the working state.
Tell the AI what you reverted and why. A short note keeps it from reintroducing the same bug in a later edit.
- Find the last commit that worked.
- Test that version in a separate branch.
- Restore only the files that broke.
- Describe the fix in your next prompt.
Common mistakes
- Rolling back everything when only one file caused the problem.
- Skipping a test run after the rollback.
