WEBVTT 00:05.260 --> 00:10.070 In this video you're going to get introduced to version control using. 00:10.540 --> 00:15.370 So first of all let us understand what Virgin control means. 00:15.370 --> 00:21.550 Let's say once you are developing a project and you'd like to keep a record of different snapshots of 00:21.550 --> 00:25.030 your projects at specific moments in time. 00:25.480 --> 00:29.910 So let's create a folder for our projects and call it projects. 00:30.110 --> 00:32.560 Version point zero. 00:32.590 --> 00:36.340 So this is going to be the first version of your projects. 00:36.970 --> 00:44.050 So you'd like to make changes inside this version and keep this version somehow safe when you move to 00:44.050 --> 00:44.950 the next version. 00:45.550 --> 00:49.300 So let's open this folder inside brackets 00:54.640 --> 00:59.380 and this creates a file and call its final one not text. 00:59.380 --> 01:04.860 And let's add some text inside we are learning web development for example 01:07.700 --> 01:17.580 let's create another file his file to the text and let's write something like coding is one. 01:17.620 --> 01:24.400 So this is the current snapshot of our projects. 01:24.550 --> 01:26.800 So we would like to keep this one safe. 01:26.980 --> 01:36.110 So before we make any changes we're going to create a new copy of this folder and call it Version 1.0 01:36.260 --> 01:40.380 to so now or one point one. 01:40.380 --> 01:47.040 So now we know that our first version is safe and we can always go back to it and check its different 01:47.040 --> 01:48.100 files. 01:48.150 --> 01:53.190 Now let's open the new version in brackets and make changes inside is 01:57.950 --> 02:01.940 let's add a new line inside find one 02:08.290 --> 02:10.450 and now let's move to the next version 02:13.240 --> 02:21.100 and we can keep going like this and carry on over and over creating new folders all the time. 02:21.400 --> 02:28.030 And he's obviously going to be laborious work and nobody really enjoys doing this. 02:28.060 --> 02:37.390 Also you need to go back to each of these folders and create a file inside 02:41.970 --> 02:42.990 with a description 02:45.560 --> 02:47.720 saying what changes you have made. 02:47.770 --> 02:59.430 So for example created file 1 not text and file to the text and added one line in each. 02:59.450 --> 03:06.500 Now this is obviously not the way it is done in real life because there are so many tools that are used 03:06.500 --> 03:08.570 for version control nowadays. 03:08.720 --> 03:14.180 So the favorite tool that is used by developers is called gets. 03:14.210 --> 03:17.230 So this is the one we're gonna be using in our calls. 03:17.270 --> 03:21.690 So let's head to the gates website and check it out. 03:21.770 --> 03:27.600 So get is a free and open source version control system. 03:27.680 --> 03:36.650 It is known for its speed and efficiency and you can use it to handle any size of projects. 03:36.650 --> 03:46.130 So to download or install gets you can click on the download button then click on this link if the download 03:46.190 --> 03:55.740 doesn't start quickly so you redirected here and the download should start shortly so you just click 03:55.740 --> 03:56.600 on save. 03:57.210 --> 04:04.410 And once your file is downloaded you just click on it and you keep clicking through the installation 04:04.410 --> 04:08.240 process and you will get gates installed on your computer. 04:08.310 --> 04:14.970 Now once you get gates installed you just head to your terminal and check that Gates has been installed 04:14.970 --> 04:22.870 successfully by checking the version of Gates by typing the command Gates version like that. 04:24.200 --> 04:29.200 So this world brings the version massive installed on your computer. 04:29.210 --> 04:33.380 Now let's understand Gates in a really easy way. 04:33.380 --> 04:36.940 So on the left hand side you can see your working environment. 04:36.950 --> 04:43.940 So this is normally the contents of your projects folder where you've got your files where you create 04:44.000 --> 04:48.530 those files delete them update them and so on. 04:48.530 --> 04:54.500 So that's your working environments so you can access these environments directly from your computer 04:55.190 --> 05:01.560 or by using a text editor like brackets where you manage files and update them. 05:01.580 --> 05:11.990 Now remember that we are using gates to create snapshots of this projects folder or this working environments 05:12.290 --> 05:13.930 at specific moments in time. 05:16.240 --> 05:20.500 But you don't have to include everything inside you snapshots. 05:20.500 --> 05:21.540 Right. 05:21.580 --> 05:29.650 You may be interested in tracking the changes of only one file and that's why Gates comes with the concept 05:29.680 --> 05:41.940 of a staging area the staging area is the area where you're going to have the files you want to watch. 05:42.040 --> 05:50.530 So for example we can decide to watch early file one and file two and in this case we're going to stage 05:50.620 --> 05:59.010 those two files so when you stage files you pass them to the staging area. 05:59.430 --> 06:05.140 So now you told Gates that's in the next snapshots. 06:05.310 --> 06:08.440 I'm going to look at a file one file too. 06:08.490 --> 06:10.670 I'm going to ignore file three. 06:10.710 --> 06:18.390 I'm only interested in these two so staging means that you are preparing these files to be committed 06:18.720 --> 06:21.360 and that's the next stage or the next step. 06:22.230 --> 06:33.670 So committing your changes or your files means that you are creating a snapshots using gets and that's 06:33.690 --> 06:39.530 not shows is going to include only the files that you staged. 06:39.950 --> 06:51.010 So now I was snapshots is going to consist of these two files and it will reflect their states and the 06:51.010 --> 06:57.320 movements in time when you created these snapshots. 06:57.320 --> 07:01.070 Now we are inside the gates repository. 07:01.250 --> 07:08.870 Now the gates reply Sorry or the gates directory is the place where Gates stores your snapshots of committed 07:08.990 --> 07:10.570 work. 07:10.580 --> 07:16.850 Now once you make a snapshot like this you can go back to your work continue making changes to your 07:16.850 --> 07:25.530 files and then stage the files you'd like to commit next time then commit them. 07:25.640 --> 07:37.040 Once you are ready then create a new snapshots of your projects and you can keep doing the same thing 07:38.490 --> 07:44.250 changing files staging them and then can we sing them like this. 07:44.340 --> 07:46.560 And creating another snapshots. 07:49.960 --> 07:51.280 Let's do this one more time 07:58.510 --> 07:59.400 and here we go. 07:59.410 --> 08:02.620 We ended up now with four snapshots. 08:02.650 --> 08:09.610 Now normally when you make a snapshot like this you attach a message to it's explaining what changes 08:09.670 --> 08:12.520 you made inside that snapshot. 08:12.550 --> 08:18.320 Now remember why do we need all these snapshots. 08:18.340 --> 08:25.060 Well we said that we would like to track the progress of our projects and see what changes took place 08:25.750 --> 08:28.600 at different moments in time. 08:28.600 --> 08:35.230 Now there is another use of having these snapshots stored inside our guest directory and that's just 08:35.230 --> 08:39.710 in case you would like to revert to one of these snapshots in the future. 08:39.940 --> 08:48.310 So let's say that we are not happy with the current state of our projects and who would like to go back 08:48.310 --> 08:49.630 to these snapshots. 08:49.650 --> 08:53.930 For example then using Gates is pretty easy. 08:53.950 --> 08:57.970 You just need to check out the projects using that stored snapshots. 08:58.360 --> 09:04.590 So we are using that snapshots to check out whatever content we had in that snapshots. 09:04.690 --> 09:12.520 And the consequence of this is going to be replacing the content of our working environments with whatever 09:12.640 --> 09:15.090 content we had inside that snapshots. 09:15.280 --> 09:19.710 Now let's understand how it works in a more visual way. 09:19.720 --> 09:26.680 So for now we're going to focus on our local Gates repository and we're going to be looking ask the 09:27.040 --> 09:28.390 master branch. 09:28.390 --> 09:34.520 So for now you don't have to worry about the branching concepts as we gonna be covering it later. 09:34.590 --> 09:41.090 But just remember that we've got only one branch meaning that any changes that we make to our projects 09:41.450 --> 09:44.900 are going to follow the same process flow. 09:44.900 --> 09:55.790 So one branch early so any files that you will see appearing here are going to be the staged ones which 09:55.790 --> 10:02.330 means that they're going to be prepared to be committed to create snapshots. 10:02.330 --> 10:07.910 So let's start by creating our first file file one daughter texts. 10:07.940 --> 10:16.220 Now if you commits here you gonna create a snapshot and you can attach a message to your commits saying 10:16.460 --> 10:19.430 created file one not text. 10:19.460 --> 10:25.390 Now if you make some changes to your file adding three lines for example and then you commit. 10:25.400 --> 10:27.150 That's another snapshots. 10:27.150 --> 10:31.670 And the message could be added three lines to file one or texts. 10:31.670 --> 10:34.170 Now let's make some further changes. 10:34.280 --> 10:44.360 So here we're gonna change that line and we can add one extra file and we're gonna recommitting and 10:44.360 --> 10:51.440 saying we created that file with one line to it's an updated the last line in file at 1. 10:51.450 --> 11:00.650 Now suppose that you are not happy with the changes that you made to file one after you committed because 11:00.650 --> 11:10.370 you realized that that change has messed up your file so you decide at this point to go back to snapshot 11:10.370 --> 11:11.770 2. 11:11.870 --> 11:14.190 So using Gates is pretty easy to do this. 11:14.270 --> 11:19.490 So you just need to check out using snapshot 2. 11:19.590 --> 11:31.470 And now you will revert to that state's like that and you can now start working again from that states. 11:31.850 --> 11:40.020 So you can go again make changes to your file delete a line for example. 11:40.300 --> 11:42.680 Then you file and then can meet again. 11:42.680 --> 11:49.670 Now the next step is to carry out all these events using the command line by applying this to a real 11:49.850 --> 11:50.870 project folder. 11:50.870 --> 11:53.240 And that's what you're going to do in the next video.