From the course: Replit 101: From Prompt to Product

Using checkpoints to go back in time - Replit Tutorial

From the course: Replit 101: From Prompt to Product

Using checkpoints to go back in time

I know from experience that when people start building apps or write code, the thing they're most concerned about is making a change that has an error in it and then not be able to recover from that change. It's not just in coding we have this problem. If you've ever worked with multiple different versions of the same document, you know what I'm talking about. Well, in coding, this issue has been solved through what's known as version control. Any time you make a change, you save the state of the code before you made that change, and then you can always come back to that state. And in Repl.it, version control happens automatically. You can actually see it in my chat right now. It says here, checkpoint made nine minutes ago, and then again, checkpoint made seven minutes ago, and so forth. These checkpoints are images of what the code looked like at that time. And you can go back and look at those checkpoints and even revert your code back to those checkpoints if you want to. So let me show you how that actually works. I'll first go in and make an error somewhere. So I'll use this selector again and then select an element. And then let's say I have a cat in my office that somehow falls over my keyboard and does something like this, and I'm not paying attention. So I click save change, and suddenly I don't remember what was there before, but I want to get it back. Now, this is a trivial change. I could do something way worse, but it illustrates the point, right? Now the agent is going through the process of updating my project and adding this new incomprehensible line of text as a feature in my project. And I'm stressing out because this is not what I want, but I can roll back my change. Over here in the chat, it says checkpoint made just now. And I can open up that tab and see visual edit was made. I can then from here just immediately roll back to this state. So that would mean rolling back to this change, which is what it's currently at, which is not what I want. And I can also click on changes to actually see what changes were made. So here it says, home TSX was changed. I can open it up and see what's called a diff. So here you see what the text looked like before. Here's what the text looks like after. And this tells me, oh yeah, right. This is the change I didn't want to happen. So let's just ignore this, walk away from it, go back to the preview. And instead, I want to go back to a previous state where things were working properly. So I can either scroll back up here to the next checkpoint, which is here, made nine minutes ago. It's also a visual edit. Let's see those changes. That's the open mic to Morten's QA. So that is the change I want to go back to. or I can go up here to this rollback history and look at the different checkpoints. So here you can see we have multiple checkpoints to choose from, but I'm gonna do it from here. So I'll go to the nine minutes ago checkpoint and just click rollback here. This resets your app to this prior version. I'm literally going back in time to a previous state of my app. When I click the button, I get information about what happens. I'll click roll back to this checkpoint. The agent now goes back, finds the original version, and brings it back into the flow of work. So now I am, again, working where I was before I made that erroneous change. Because of how this works, you can actually go back as far as you want and make changes. And you can also go back in time to look at what changes were made prior to figure out where exactly and when exactly you made a change that may have effects later. And as you saw, you can click through and see exactly what changes were made where, and then maybe recover data from there by copying and pasting something out or doing something else. This is, in all honesty, like time travel in your project. You can travel back and forth in time through your project to ensure that you never lose anything and that you never make a mistake that you can't recover from.

Contents