When working with Claude Code, or any AI for that
matter, things can also go bad, or you
may implement a change you're not happy
about once it's done. Now, for example here, I'm asking the
AI to output an incrementing counter on the
homepage. Claude Code then, of course, does its
thing and this is not a super difficult task, so it most
likely will get that done. Though, as a little side note, it
is using an anti-pattern here by incrementing the count like
this. But that's not really what this video
Let's say you're not happy with that change though.
You wanna revert it. You then have two main
options. Option one is that you use
version control, like Git. And you should do that in any
project, of course, not just when working with AI, but especially when
working with AI. You wanna create
commits frequently. You wanna be able to go back to older
states, restore states. That is more important than
ever with AI because AI can mess up your code
base. It might even delete files you didn't want
delete. So having a version history and being able to
go back is more important than ever.
Also, by the way, because with editors like Visual Studio
example, you can use their version control system
then review the changes made by AI with the built-in
version control diff tools so that you can see what changed in which
file, so that can make reviewing AI changes
nice side effect of using version control. So that's important.
But when using Claude Code, you also have another way
of undoing changes you're not happy about.
Again, doesn't replace version control because
it's worth knowing about the fact that you can undo changes
made by Claude Code. The first way of undoing
changes is to simply press the escape key
twice after a change you're not happy about.
You see, I pressed it twice and then it says, "Rewind?
Restore the code?" And now I can choose where I
want that code to restore to. Current
is the current snapshot, but I could go to the beginning of this
conversation and you'll see that if I do that, I'm
back to that beginning of the conversation.
The alternative would be to use the slash rewind command
and then there, you would see those sessions too to
rewind. Now, I don't have any here because I did just
session I had, but you could do it here as well.
Now, I will say though, at least at the point of time where I'm
this, the rewind feature is a bit buggy for me at
least, which is of course bad for this kind of
But for me here, it said that it did rewind, but the counter
there. In the version control system, I can still see that that
change is still there and would be in the next
commit I create. So yeah, that kind of proves the
point why having a version control tool like Git is even more important.
But that rewind tool is also there.
It might be working for you and it is something you can use
about a change. But if it doesn't work or if you can't rewind
for any other reason, then version control systems
help you out.