WEBVTT 00:06.550 --> 00:10.540 Let's start with an overview of what we did in the previous video. 00:10.810 --> 00:19.510 So we managed to fork our github repository into a new github account meaning that we created a copy 00:19.570 --> 00:30.820 of Nas repository inside the new github account and then we cloned that repository or that new repository 00:30.910 --> 00:40.780 which is a copy of the old one we cloned it into this new local environment creating a local repository 00:41.800 --> 00:53.500 and then we made some changes and committed them and then we tried to push this repository back to the 00:53.530 --> 00:57.570 github account with all the changes that we made. 00:57.580 --> 01:06.070 Now we had a problem at this stage because I was working with to get hub accounts and I was still locked 01:06.070 --> 01:07.960 in to the old one. 01:07.960 --> 01:14.290 So when I tried to push the changes to the new github account I was still connected to the old one and 01:14.290 --> 01:16.140 the push failed. 01:16.150 --> 01:18.800 Now let's find a way to fix that. 01:19.060 --> 01:25.750 First let's understand why we were still logged into the old accounts and we were not prompted to enter 01:26.080 --> 01:30.180 our user name and password when logging in to get up. 01:30.730 --> 01:38.170 So to do this we can have a look at our configuration settings for Gates by using the command Gates 01:38.890 --> 01:41.680 config and the option list. 01:42.430 --> 01:46.640 So this will print the list of configuration settings. 01:47.450 --> 01:56.820 Forget say if you use the down arrow you can see more settings and the one we are interested in is credential 01:57.030 --> 01:58.520 dot helper. 01:58.620 --> 02:05.590 So at the moment your password and your username are stored right there in you in the OS X keychain 02:06.460 --> 02:10.680 and they are used automatically when you try to log into GitHub. 02:11.100 --> 02:15.260 So basically we are forced to log into the old accounts. 02:15.420 --> 02:19.860 So we're gonna need to unset this variable so 02:22.590 --> 02:37.420 to do that I'm going to use a command get config then sys and sets followed by the variable Alexa on 02:37.430 --> 02:38.020 set. 02:38.170 --> 02:42.120 Now before assessing the variables let's check its value. 02:42.460 --> 02:51.690 So we look in its credential but helper and the value is OSX keychain. 02:51.700 --> 02:58.380 Now I used system just in case this has been set in the system configuration file. 02:58.390 --> 03:00.340 Now let's set this value 03:10.790 --> 03:17.510 so of course an error here because I need to be logged in as an administrator so I'm going to use sudo 03:18.350 --> 03:19.610 followed by the command. 03:22.430 --> 03:33.270 Then I need to put my computer password my accounts password and now if I check the value 03:36.310 --> 03:40.480 I don't get anything because we have just and says it's no. 03:40.490 --> 03:41.780 If you're on Windows 03:44.540 --> 03:45.590 you can go to 03:48.630 --> 03:50.190 your control panel. 03:50.190 --> 03:56.680 User accounts credential manager and manage your credentials there. 03:57.290 --> 04:07.080 So in your generic credentials you'll find GitHub and all you need to do is remove those credentials 04:07.170 --> 04:07.500 from the 04:10.400 --> 04:10.980 right now. 04:11.020 --> 04:24.960 Let's try to push to get hub again and make sure that this time we are prompted to input our credentials. 04:24.960 --> 04:25.360 Here we go. 04:25.360 --> 04:36.000 It's asking for the username so while the new accounts the user name is gentle 04:38.570 --> 04:39.200 collaborator 04:42.620 --> 04:44.440 and agreeing to inputs my password. 04:50.360 --> 04:52.920 Um this time our push has been successful. 04:52.930 --> 04:54.000 Now let's check. 04:54.000 --> 05:05.210 That's my refreshing this page and checking the contents of the files that we changed earlier. 05:05.210 --> 05:13.260 So here we go file 5 so that's the new line we added to line 5 and file 6. 05:13.300 --> 05:15.460 But the new line we added 2 5 6 05:18.250 --> 05:24.720 and that's the last commits which we made involving both those files. 05:25.150 --> 05:32.620 At this stage we simulated successfully how our collaborator would push the changes they made locally 05:32.830 --> 05:44.810 to their own github account and now the next step is to make a poor request so a pull request means 05:45.050 --> 05:50.050 that they are going to suggest their changes to us basically. 05:50.150 --> 05:56.570 So whatever feature they added to the code whatever bug they fixed in the code they're going to tell 05:56.570 --> 06:04.150 us well we would like you to incorporate those changes in your final code. 06:04.610 --> 06:09.980 So let's go ahead and simulate this now before making a pull request. 06:09.980 --> 06:14.520 Let's go to insights and then network and just have a quick look again. 06:14.660 --> 06:24.050 Ask the history of this repository so the owner here is our collaborator and we can see here the full 06:24.050 --> 06:29.720 history of the repository including all branches. 06:29.720 --> 06:36.950 And this is the last change which was made by this user development island. 06:36.970 --> 06:46.130 Now that change was made by office code prior to the forking that's one as well. 06:46.840 --> 06:53.420 And this one shows development Island because I've done this on my computer and the user of that moment 06:53.590 --> 06:55.910 or that Sage was development island. 06:55.930 --> 06:58.660 That's why we see this as the user. 06:58.660 --> 07:11.620 Now if I go back and make a change to any of these files so for example I can add a line right there 07:16.380 --> 07:20.730 and then a comment and commits 07:24.190 --> 07:34.640 then if I go back to insights and network the last change will show as mean done by gentle collaborator 07:35.420 --> 07:44.120 because I've done this directly inside GitHub and the user is gentle collaborator whereas that's change 07:44.120 --> 07:50.560 was done by developments Island as I've done that's on development Island's computer locally. 07:50.560 --> 07:57.820 Now let's make a pull request so I'm going to go to code and then new poll requests 08:01.410 --> 08:10.260 so if I scroll down I can see the changes which were made to the repository which I forked from of your 08:10.260 --> 08:10.550 code. 08:10.620 --> 08:17.310 So I did a line there and I did a couple of lines there and it says here that these branches can be 08:17.310 --> 08:25.020 automatically merged talking about the master branch of of your code and the master branch of gentle 08:25.020 --> 08:25.830 collaborator. 08:25.830 --> 08:32.700 Now I can click on this green button to create the pull request and I can add a title and a comment. 08:33.030 --> 08:45.030 For example changed file 5 and file 6 added a few lines. 08:45.070 --> 08:46.750 So this creates the pull request. 08:49.560 --> 09:02.520 Now if I head to the first account and refresh the page then I can see one new poll request so I can 09:02.520 --> 09:06.560 see that it has been made by gentle collaborator. 09:06.850 --> 09:13.510 And this is the title and here are the comments. 09:15.000 --> 09:21.510 I can also see the list of comments made since my repository was forked. 09:21.510 --> 09:31.680 So if I click on any of these comets then I can see the details of the comet so this is the first Comets 09:31.710 --> 09:34.640 when we change final 5 and final 6. 09:34.710 --> 09:41.010 This is the second comets when we updated final 6 directly from GetUp. 09:41.010 --> 09:44.550 That's why we see gentle collaborator as the owner. 09:44.550 --> 09:53.220 Well we see developments Ireland as the author of Love change which was made locally on my computer 09:54.040 --> 09:55.770 when pushed to get up. 09:55.830 --> 10:07.940 Now if I go to insights then network I won't see those comets in my own branches but I'm going to see 10:07.940 --> 10:11.740 them next to Daniel collaborator. 10:11.920 --> 10:21.100 All right now if I want to merge the pull request meaning that I'm going to incorporate those changes 10:21.970 --> 10:30.070 into my own master branch then I just need to make sure that I am happy with any changes made by gentle 10:30.070 --> 10:31.240 collaborator. 10:31.300 --> 10:38.020 And then if I'm happy with them then I'm going to approve the changes and then I'm going to merge them 10:38.170 --> 10:47.020 into my master branch so let's go ahead and do this by clicking on this green button I'm going to change 10:47.020 --> 10:59.730 the title to merge file 5 and file 6 changes from gentle collaborator let's confirm the merge 11:02.500 --> 11:04.030 all right. 11:04.690 --> 11:08.260 If you change your mind you can always revert that change. 11:08.260 --> 11:10.920 So now let's have a look. 11:10.920 --> 11:19.480 Odds are insights then network and now we can see the changes made by gentle collaborator right after 11:19.480 --> 11:21.010 forking our muscle branch. 11:21.130 --> 11:27.520 So right after that change they forked our muscle branch and then they made those changes. 11:27.610 --> 11:31.500 So the first change happened locally on a computer. 11:31.630 --> 11:36.310 It was made by developments Ireland and then pushed back to get hub. 11:36.340 --> 11:42.750 The second change or commit was made directly by gentle collaborator inside GetUp. 11:43.330 --> 11:53.540 And then they created a pull request which we approved and then we merged their changes into our massive 11:53.540 --> 11:54.640 branch. 11:54.730 --> 12:01.270 Now since we covered many concepts in this example it's a good idea to go through a quick summary to 12:01.270 --> 12:03.740 make sure that these concepts sink in. 12:04.150 --> 12:12.400 So first of all we were working on our own local repository which we pushed to our own github account 12:12.970 --> 12:21.970 and then after US dental collaborator forked our github repository into their own github accounts. 12:22.000 --> 12:28.580 Basically they created a new repository which is a copy of our own GitHub repository and then after 12:28.580 --> 12:36.460 that instead of making changes directly on GitHub they chose to clone that github repository into their 12:36.460 --> 12:39.140 own local environments. 12:39.160 --> 12:45.040 So this created a new repository is a copy of that one in their local computer. 12:45.040 --> 12:53.710 So they used their favorite editor to make changes and commit them and then afterwards they pushed back 12:53.710 --> 13:06.770 those changes to their own github accounts and then they created a pull requests asking us to review 13:07.370 --> 13:14.870 those changes and if we're happy with them to incorporate them into our own projects. 13:14.870 --> 13:22.970 Now we had the chance to have a quick look and approve the changes and then we merged those changes 13:23.030 --> 13:25.200 into our own projects. 13:25.280 --> 13:31.310 So hopefully this gave you a good understanding of how remote repositories work and how you can use 13:31.310 --> 13:35.780 these tools and concepts to do collaborative work.