WEBVTT

00:00:00.100 --> 00:00:03.700
When working with Claude Code,
or any AI for that

00:00:03.740 --> 00:00:07.180
matter, things can also go bad, or you

00:00:07.560 --> 00:00:10.940
may implement a change you're not happy

00:00:11.060 --> 00:00:14.620
about once it's done. Now,
for example here, I'm asking the

00:00:14.680 --> 00:00:17.220
AI to output an incrementing counter on
the

00:00:17.260 --> 00:00:20.920
homepage. Claude Code then, of course,
does its

00:00:21.140 --> 00:00:24.780
thing and this is not a super difficult
task, so it most

00:00:24.820 --> 00:00:28.560
likely will get that done. Though,
as a little side note, it

00:00:28.680 --> 00:00:32.549
is using an anti-pattern here by
incrementing the count like

00:00:32.619 --> 00:00:35.589
this.
But that's not really what this video

00:00:35.620 --> 00:00:38.670
Let's say you're not happy with
that change though.

00:00:38.700 --> 00:00:42.280
You wanna revert it.
You then have two main

00:00:42.420 --> 00:00:46.240
options. Option one is that you use

00:00:46.300 --> 00:00:50.200
version control, like Git.
And you should do that in any

00:00:50.360 --> 00:00:54.200
project, of course, not just
when working with AI, but especially when

00:00:54.300 --> 00:00:57.680
working with AI. You wanna create

00:00:57.940 --> 00:01:01.640
commits frequently.
You wanna be able to go back to older

00:01:01.720 --> 00:01:05.349
states, restore states. That
is more important than

00:01:05.420 --> 00:01:09.260
ever with AI because AI can mess up your
code

00:01:09.280 --> 00:01:12.480
base.
It might even delete files you didn't want

00:01:12.560 --> 00:01:16.470
delete. So having a version history
and being able to

00:01:16.560 --> 00:01:18.880
go back is more important than ever.

00:01:18.940 --> 00:01:22.600
Also, by the way,
because with editors like Visual Studio

00:01:22.660 --> 00:01:26.020
example,
you can use their version control system

00:01:26.060 --> 00:01:29.920
then review the changes made by AI with
the built-in

00:01:30.220 --> 00:01:34.200
version control diff tools so
that you can see what changed in which

00:01:34.320 --> 00:01:38.280
file,
so that can make reviewing AI changes

00:01:38.320 --> 00:01:41.680
nice side effect of using version control.
So that's important.

00:01:41.700 --> 00:01:45.440
But when using Claude Code,
you also have another way

00:01:45.540 --> 00:01:48.020
of undoing changes you're not happy about.

00:01:48.080 --> 00:01:52.020
Again,
doesn't replace version control because

00:01:52.060 --> 00:01:55.760
it's worth knowing about the fact
that you can undo changes

00:01:55.840 --> 00:01:59.340
made by Claude Code.
The first way of undoing

00:01:59.350 --> 00:02:02.760
changes is to simply press the escape key

00:02:02.820 --> 00:02:06.420
twice after a change you're not happy
about.

00:02:06.460 --> 00:02:09.580
You see, I pressed it twice
and then it says, "Rewind?

00:02:09.639 --> 00:02:13.350
Restore the code?"
And now I can choose where I

00:02:13.420 --> 00:02:17.280
want that code to restore to. Current

00:02:17.340 --> 00:02:20.740
is the current snapshot,
but I could go to the beginning of this

00:02:20.780 --> 00:02:24.740
conversation and you'll see that
if I do that, I'm

00:02:24.780 --> 00:02:27.000
back to that beginning of the
conversation.

00:02:27.140 --> 00:02:30.980
The alternative would be to use the slash
rewind command

00:02:31.540 --> 00:02:35.400
and then there,
you would see those sessions too to

00:02:35.460 --> 00:02:39.120
rewind. Now,
I don't have any here because I did just

00:02:39.220 --> 00:02:42.090
session I had,
but you could do it here as well.

00:02:42.140 --> 00:02:45.910
Now, I will say though,
at least at the point of time where I'm

00:02:45.940 --> 00:02:49.600
this, the rewind feature
is a bit buggy for me at

00:02:49.640 --> 00:02:52.740
least,
which is of course bad for this kind of

00:02:52.760 --> 00:02:56.580
But for me here, it said
that it did rewind, but the counter

00:02:56.600 --> 00:03:00.480
there. In the version control system,
I can still see that that

00:03:00.500 --> 00:03:04.480
change is still there
and would be in the next

00:03:04.520 --> 00:03:08.100
commit I create. So yeah,
that kind of proves the

00:03:08.140 --> 00:03:11.790
point why having a version control tool
like Git is even more important.

00:03:11.820 --> 00:03:14.890
But that rewind tool is also there.

00:03:14.900 --> 00:03:18.640
It might be working for you and it
is something you can use

00:03:18.700 --> 00:03:22.540
about a change. But if it doesn't work
or if you can't rewind

00:03:22.600 --> 00:03:26.380
for any other reason,
then version control systems

00:03:26.420 --> 00:03:27.320
help you out.
