Backup and undo

I am curious on a few things.

  1. Is there a way to UNDO something you did in the editor? I almost lost a bunch of my code by accident so wondering.

  2. As far as backup for a project (just in case I delete and can’t undo) - is the best to download the project to my computer to save?

Thanks for any advise.

You can undo what you’ve just typed with cmd+z. We also have our Rewind feature, which you can open by clicking on the two left arrow icon next to Logs in the editor. That enables you to roll your project back to a prior date/time.

For backups you can save a zip file of your project or export to GitHub. Both are available under advanced options from the top-left project info menu in the editor.

1 Like

Awesome Gareth! Thanks for the help!

What about the .env file?

The export options (download to zip or connect via git) are great, but they only cover the source code and not the asset files, which are stored in the Glitch CDN and dynamically referenced. Call me paranoid, but I want to back everything up just to be safe.

The easiest method I could come up with was the following script:

# Grab the .glitch-assets JSON file and extract the URLs
curl -s 'https://<id>' | jq -r ".url" > urls.txt
# Download each URL in turn
wget -i urls.txt

This will grab everything listed in the .glitch-assets file, which is basically everything in the virtual assets folder, including deleted files.

Replace <id> with the name of your Glitch. On Mac you might need to install jq, which I did with homebrew.