WEBVTT

00:01.920 --> 00:08.160
When we're working on code, whether it is just us or an entire team, it is super important to keep

00:08.200 --> 00:09.960
track of the changes we make.

00:10.360 --> 00:16.160
And this is where git and version control come in, especially when coding the.

00:16.160 --> 00:21.560
I might generate code that doesn't work or can even break the application entirely.

00:21.800 --> 00:25.320
And it can be difficult to revert to a previous version.

00:25.560 --> 00:31.960
With git, we can easily roll back to a previous version that did work without losing anything.

00:32.720 --> 00:33.720
So how does it work?

00:33.720 --> 00:40.200
Every time we make progress and have a state that is working and that we're happy with it, we can commit

00:40.200 --> 00:45.560
the changes so that we have a record of how the code looked like at that point in time.

00:45.800 --> 00:48.200
And I'm going to show you it is relatively easy.

00:48.400 --> 00:53.400
The first thing that we need to do is conversion this project with git.

00:53.440 --> 00:58.320
So all you need to do is instruct the agent to add git to this project.

00:59.200 --> 01:02.840
So the agent will interact with the git CLI tool.

01:02.840 --> 01:06.320
You're going to see here that we are being asked to run this command.

01:06.560 --> 01:09.320
Git init is going to initialize a git repository.

01:09.800 --> 01:14.710
It's going to create also a git ignore file, which is super important because there are some files

01:14.710 --> 01:17.390
that we definitely do not want to store under git.

01:17.470 --> 01:21.150
For example, we have here the dependencies in the node modules.

01:21.270 --> 01:24.830
There can also be other files that we don't want to have there.

01:25.350 --> 01:26.510
We can take a look here at.

01:26.550 --> 01:29.590
Gitignore file we're going to see here what has been added to it.

01:29.910 --> 01:31.590
Quite a few files here.

01:31.590 --> 01:33.510
We're going to click here on accept.

01:34.430 --> 01:37.670
Now the next part is staging the files.

01:37.710 --> 01:41.910
Now we definitely do want to have a look at everything that is inside here.

01:41.910 --> 01:45.550
For example there's still this temp vite project that I have here.

01:45.550 --> 01:48.350
And this is something that I no longer want to have inside.

01:48.510 --> 01:51.190
So I'm going to go ahead and delete this project.

01:51.190 --> 01:55.150
I also want to make sure that I'm not committing any changes that shouldn't be there.

01:55.390 --> 01:57.230
The rest of them look quite okay.

01:57.230 --> 02:03.430
So I'm gonna stage the files, which simply means that we are adding these files to a secondary stage

02:03.430 --> 02:08.110
where we're preparing to commit them, and then we're going to create the initial commit.

02:08.550 --> 02:10.670
And this commit is going to get a message.

02:10.670 --> 02:13.910
This is something that the agent is doing automatically for us.

02:13.950 --> 02:19.630
It's going to provide a nice message explaining what we have done with this particular change.

02:20.790 --> 02:22.710
So it has been initialized a.

02:22.750 --> 02:24.510
Gitignore file has been created.

02:24.510 --> 02:27.650
So now we have this these particular changes here.

02:28.250 --> 02:30.730
Now, there's one important thing I want to point out.

02:30.730 --> 02:36.570
You're going to see that whenever the agent is making changes to a specific file, you're going to get

02:36.610 --> 02:39.930
here this prompt accept file or reject file.

02:39.970 --> 02:42.970
And you're going to also see here accept or reject.

02:43.530 --> 02:45.290
This is independent of git.

02:45.290 --> 02:49.130
And this is a way of reverting recent changes that I made.

02:49.410 --> 02:50.930
This is still an important feature.

02:50.930 --> 02:54.570
And it's kind of like a quick way to revert to something that was working.

02:54.570 --> 02:57.410
But sometimes you can make a lot of changes.

02:57.410 --> 02:59.810
You can even accept the changes that I made.

03:00.050 --> 03:04.850
And this is when actually git can be an interesting backup.

03:05.010 --> 03:09.250
So we can go over the individual files and see exactly what has changed here.

03:09.250 --> 03:12.210
So we can see what are the changes in this file.

03:12.250 --> 03:14.130
So here we're going to get a prompt.

03:14.130 --> 03:15.450
Something has been removed.

03:15.450 --> 03:17.730
This is why it is in red.

03:18.090 --> 03:20.050
And we can accept this particular change.

03:20.090 --> 03:25.810
Or we can accept the entire file or we can accept everything if there are multiple files that have been

03:25.810 --> 03:26.330
changed.

03:26.650 --> 03:35.050
Just keep in mind git and this version control of accepting or rejecting files from cursor are slightly

03:35.050 --> 03:37.570
different, but they're all very, very helpful.
