#chatgpt#claude#ai-coding#beginners#backup

How to Not Lose Your Project When Using ChatGPT or Claude for Coding

Practical tips to protect your code when building with AI assistants. Never lose work to an AI mistake again.

Building with ChatGPT or Claude is fast and exciting until the moment everything breaks. You paste in some AI-generated code, and suddenly nothing works. Worse, you can’t remember what your code looked like before.

This happens to everyone at least once. Here’s how to make sure it’s not catastrophic when it happens to you.

The Pattern That Gets People

The typical disaster scenario looks like this: You’re building something. It’s working. You ask the AI for one more improvement. You paste the response into your code. It doesn’t work. You ask the AI to fix it. Now it’s more broken. Three iterations later, you have no idea what your original code even looked like.

Or the more dramatic version: The AI gives you a “refactored” version that consolidates everything. You replace your files with its suggestion. Half of what you had is now gone.

The problem isn’t that AI makes mistakes. It’s that by the time you realize something is wrong, the working version is already lost.

The Copy-Paste Solution

The simplest protection is manual backups. Before you paste any AI-generated code into your project, copy your current working code somewhere else first.

Keep a text file or notes document open. Before each AI experiment, paste your current code there with a note about what version it is. If things go wrong, you have a copy to restore from.

This works. It’s also tedious and easy to forget, which is why most people don’t do it consistently.

The Multiple Files Approach

A slightly better approach is keeping multiple versions as separate files:

app.js
app-working-v1.js
app-backup-before-ai.js

When something works, duplicate the file before experimenting further. If the experiment fails, you have the previous version right there.

This gets messy quickly with many files, but it’s better than losing everything.

Using Git

Git is the professional approach. It creates explicit save points you can return to.

Set up Git (one time):

cd your-project
git init
git add .
git commit -m "Initial working version"

Before risky AI experiments:

git add .
git commit -m "Before trying AI suggestion"

If things break:

git checkout .    # Restores everything to the last commit

Git works well if you’re disciplined about committing. The problem is that in the flow of AI iteration, you forget. You think “I’ll commit after this next change,” and then three changes later everything is broken.

Automatic Protection

The most reliable approach is capturing every change automatically, without you having to remember anything.

mrq was built for exactly this. You start it once:

npm install -g mrq-cli
mrq login
mrq watch

From that point on, every file change is captured automatically. When the AI breaks something:

mrq history        # See all recent states
mrq restore abc123 # Go back to any point

You don’t have to remember to save. You don’t have to break your flow. The safety net is just always there.

Specific Tips for ChatGPT and Claude

When you’re using ChatGPT or Claude in a browser, you’re copying code back and forth manually. The AI can’t break your files directly, but you can break them by pasting the wrong thing.

Before pasting AI code, save a copy of what’s there. Consider using an editor with auto-save and local history (VS Code has Local History built in).

When using Cursor, Claude Code, or Windsurf, the AI edits files directly. This is faster but riskier. Have mrq running before you start so every change is captured.

When Things Go Wrong

If you’ve already lost code and are trying to recover:

First, try undo in your editor (Cmd+Z / Ctrl+Z). If the file tab is still open, you might be able to undo back to a working state.

Check Local History in VS Code or Cursor: Cmd+Shift+P → “Local History: Find Entry to Restore”

If you committed recently: git checkout .

Check system backups (Time Machine on Mac, File History on Windows).

Check cloud sync services if you use Dropbox, iCloud, or Google Drive.

If none of these work, you’re reconstructing from memory. It’s painful, which is why setting up protection before you need it matters.

The Setup That Prevents Problems

For the five minutes it takes, set this up before you start:

npm install -g mrq-cli
mrq login
cd your-project
mrq watch

Now code freely. Experiment with AI suggestions. Try risky refactors. If anything breaks, mrq restore puts you back exactly where you were.

AI coding is powerful but unpredictable. Having reliable recovery means you can take advantage of the power without fearing the unpredictability.


mrq captures every file change automatically. Instant recovery when AI breaks things.

Written by mrq team