WEBVTT 00:06.350 --> 00:10.110 In this video you're going to get introduced to get a job. 00:10.130 --> 00:12.340 So what is GitHub. 00:12.350 --> 00:20.420 Github is a software development platform which is used by developers around the world to host their 00:20.420 --> 00:26.320 code or to be accurate to host their gates repositories so far. 00:26.360 --> 00:31.790 You have being creating repositories on your own computer locally. 00:31.790 --> 00:42.050 So you manage to make changes to your projects commit changes create snapshots and everything is currently 00:42.410 --> 00:44.500 on your computer. 00:44.510 --> 00:49.130 Now what if you wanted to involve other developers. 00:50.550 --> 00:53.530 Who could contribute to your code. 00:53.760 --> 01:01.230 The best way would be to house your code or your project's repository in a remote server and also give 01:01.290 --> 01:05.400 access to other developers so that they can make changes to your code. 01:05.520 --> 01:09.170 And obviously you want to be able to control that access. 01:09.330 --> 01:12.690 So get hub provides you with that solution. 01:12.780 --> 01:21.450 So GitHub comes with all these features and many other ones so you can push your code or your repository 01:21.690 --> 01:30.250 to the github server just like this and you will have a remote repository which is hosted in a gate 01:30.260 --> 01:30.560 hub. 01:32.040 --> 01:35.970 So let's head to the get hub Web site and understand how this works. 01:36.090 --> 01:38.410 So first of all you need to create an account. 01:38.970 --> 01:46.970 And then once you do that you just click on the plus button to create a new repository so you can give 01:47.000 --> 01:50.150 a name to your repository. 01:50.210 --> 01:57.210 So I'm going to call these projects and you can add a description if you're like and then. 01:57.230 --> 02:04.940 For now I'm not going to initialize this repository with a read me file as I'm going to push my local 02:04.940 --> 02:07.420 repository to get hub. 02:07.460 --> 02:12.110 So let's create this repository. 02:12.190 --> 02:18.580 Now you've got the choice between installing the application or the desktop application or using the 02:18.580 --> 02:19.120 command line. 02:19.120 --> 02:22.450 So we're going to be using the command line in this course. 02:22.450 --> 02:28.120 So I'm going to push an existing repository using the command line. 02:28.120 --> 02:30.940 So this is the option I'm going to go for. 02:31.810 --> 02:33.820 So you've got two commands here. 02:33.820 --> 02:36.580 So the first one is get remote. 02:36.600 --> 02:45.870 And so this command will create a new remote repository for you called origin. 02:45.910 --> 02:50.500 Now you can call it anything you like but usually it is called origin. 02:50.800 --> 02:57.160 And this is the link which you are setting origin to or your origin remote too. 02:57.190 --> 02:57.730 All right. 02:57.760 --> 03:05.350 So again origin is the name of the remote and this is the location that you are setting your remote 03:05.350 --> 03:06.540 to. 03:06.670 --> 03:19.840 And then the next command is pushing your local repository to the origin remote which you ordered earlier 03:20.980 --> 03:32.040 and you're doing that in the master branch of the origin remote and the option here minus you will make 03:32.040 --> 03:37.140 sure that Gates remembers this branch for you. 03:37.140 --> 03:48.000 So next time if you try gets push origin without specifying the branch then that's going to work absolutely 03:48.000 --> 03:53.850 fine because he told Gates to remember the branch for you. 03:53.970 --> 03:54.210 All right. 03:54.210 --> 03:56.580 So let's try this on our computer. 03:56.580 --> 03:58.380 So we're going to copy this command 04:04.190 --> 04:06.220 we get the next one 04:13.140 --> 04:25.320 so it's asking for my gates hub username so that's the one and the password. 04:25.570 --> 04:29.610 So these are the same details that he used to log into your account. 04:29.650 --> 04:37.600 Now I have just pushed the contents of my local repository to the branch master of the remote that we 04:37.600 --> 04:39.160 called origin. 04:39.160 --> 04:43.380 So let's have a look at our projects in GitHub and see what we've got. 04:43.390 --> 04:45.870 So all you need to do is refresh this page. 04:46.210 --> 04:53.410 And now you will see the contents of your local repository which has been pushed to your remote repository 04:53.650 --> 04:54.720 in GitHub. 04:54.730 --> 05:01.870 Now anyone who has got your remote link will be able to access your repository preview of the files 05:02.260 --> 05:09.780 and they can also download the whole repository on their computer or clone it using the command line. 05:09.800 --> 05:11.860 And that's something we're going to cover later. 05:11.930 --> 05:13.580 So let's try from a private tab 05:16.530 --> 05:20.880 and you can see that we can see all the files. 05:20.880 --> 05:21.140 All right. 05:21.150 --> 05:31.220 Now if you click on any of these files you can edit the file if you like by clicking on this icon so 05:31.250 --> 05:32.480 it's not an extra layer. 05:32.480 --> 05:33.080 For example 05:42.490 --> 05:51.430 you can also commit the changes by clicking on the commit button you can also create a new branch for 05:51.580 --> 05:53.150 this specific commits. 05:53.180 --> 05:56.050 For now I'm just going to commit in the master branch 06:00.240 --> 06:03.800 so I committed without a message. 06:03.840 --> 06:09.540 Now you can also see the history of comets by going to insights 06:12.230 --> 06:20.940 network and here you can see all the previous comets which took place in this branch. 06:21.060 --> 06:27.790 So these ones happened locally on our computer and they have all been imported. 06:28.110 --> 06:36.120 And is this is the new one which we created just now where we updated file on. 06:36.240 --> 06:43.380 Now if you go back to your products page you can do some other things that you normally do using the 06:43.380 --> 06:48.390 command line so you can see the current branch that you're working on is master. 06:48.390 --> 06:55.510 Now if you want to switch branches you can do that using this tab at the moment. 06:55.510 --> 06:58.870 We of course only one branch so we can create a new branch. 06:58.920 --> 07:04.640 So for example let's create a branch called feature 1 07:08.770 --> 07:13.530 and let's make some changes inside this branch. 07:13.540 --> 07:17.420 So automatically we've been switched to this branch. 07:17.520 --> 07:21.110 So if I want to go back to master it just click there. 07:21.140 --> 07:31.330 So let's go back to our new branch and make a change for example in final three so let's add a new line 07:36.530 --> 07:40.370 and let's commit the changes let's just say 07:45.600 --> 07:49.820 I did one line and let's commit 07:52.760 --> 08:03.410 so now if we go to insights network you can see that we've got two branches now the master branch and 08:03.410 --> 08:05.860 the feature one branch. 08:06.110 --> 08:10.560 And you can also see the history or the log of each branch. 08:10.680 --> 08:14.060 So that's the log of the first branch the master branch. 08:14.090 --> 08:18.370 And that's the log of our new branch there. 08:18.370 --> 08:23.180 Let's make another change insight on your branch 08:36.860 --> 08:37.490 let's commit 08:40.230 --> 08:41.750 and let's have a quick look. 08:41.760 --> 08:47.150 Ares history again. 08:47.440 --> 08:53.980 Now the new change which we made we made is actually in the master branch not the feature branch. 08:54.850 --> 08:58.780 So it is go again and make a change in the feature. 08:58.780 --> 09:05.660 One runs let's go to file five for example and it's of a line. 09:06.310 --> 09:07.210 Line two for example 09:13.460 --> 09:14.170 let's commits 09:18.640 --> 09:22.900 so this time you can see that we've got three changes in the feature one branch. 09:22.900 --> 09:24.240 So that's the first change. 09:24.280 --> 09:25.450 Second one. 09:25.450 --> 09:27.740 And then last one. 09:27.760 --> 09:35.890 Now if you want to merge feature one branch into the master branch you can go back to the projects page 09:36.580 --> 09:40.780 and then create a new pull request. 09:40.780 --> 09:49.590 Now you're going to compare the base branch which is the master branch with the feature one branch and 09:49.590 --> 09:59.530 here you can see that we're able to merge and there are no conflicts between the two branches and other 09:59.550 --> 10:09.080 but some you can see the different changes which took place inside our feature one branch. 10:09.110 --> 10:09.470 All right. 10:09.890 --> 10:19.880 So to create a pull request you can discard a comments here like I'll add some nice features. 10:19.920 --> 10:22.050 So this creates the pull request 10:25.270 --> 10:32.740 and then if I scroll down I can just click on Merge pull request and this will happen automatically 10:32.740 --> 10:39.020 because we have no conflicts between the two branches so I'm going to confirm the image 10:42.900 --> 10:50.910 and now feature one has been merged into the master branch and you can see that's the new branch has 10:50.910 --> 10:52.920 been safely deleted. 10:52.920 --> 10:59.280 Now if we go back to insights and then network you can see that we have now merged feature one into 10:59.340 --> 11:01.180 the master branch. 11:01.320 --> 11:07.030 Now to get familiar with the interface you can play with the different components and types. 11:07.050 --> 11:17.360 So for example you can go to the code tab and try to create a new file for example let's call his file 11:17.530 --> 11:19.190 six not text 11:22.440 --> 11:24.140 and list out a line 11:31.490 --> 11:37.970 unless chemistry changes you can also upload files if you like. 11:37.970 --> 11:46.070 So you can do so many things but you can do using the command line on a local repository. 11:46.160 --> 11:53.270 All right in the next video you're going to dive into cloning forking and all requests.