1 00:00:12,420 --> 00:00:14,310 Hi, everybody, and welcome again. 2 00:00:14,640 --> 00:00:18,540 Today, we're going to discuss a new topic, which is GitHub and version control. 3 00:00:18,870 --> 00:00:23,190 Before beginning, I just want to say a few words about GitHub and what they are. 4 00:00:24,090 --> 00:00:28,590 GitHub provide cloud services, same as Google Drive. 5 00:00:29,670 --> 00:00:30,660 In Google Drive. 6 00:00:30,660 --> 00:00:34,140 We can upload videos, photos or documents. 7 00:00:34,470 --> 00:00:38,880 And then whenever we need them, we can download them back to our computer. 8 00:00:39,720 --> 00:00:47,370 Programmers worldwide are using GitHub for the same purpose, but not for just files or documents. 9 00:00:47,640 --> 00:00:50,760 They're using it for their programming projects. 10 00:00:51,250 --> 00:01:00,930 OK, and using GitHub, we can control our projects and can make them safe from upcoming changes, constant 11 00:01:00,930 --> 00:01:03,510 changes that can be made by programmers. 12 00:01:04,320 --> 00:01:11,820 For example, I have a working project, a working website project that I've built and currently everything's 13 00:01:11,820 --> 00:01:12,180 fine. 14 00:01:12,180 --> 00:01:13,200 It works fine. 15 00:01:13,410 --> 00:01:15,810 So I'm uploading it to GitHub. 16 00:01:16,590 --> 00:01:23,040 And then someone from my team made some changes that made the project to be broken and corrupted. 17 00:01:23,190 --> 00:01:25,860 And sadly, nothing is working in the project. 18 00:01:26,100 --> 00:01:26,990 But that's all right. 19 00:01:27,330 --> 00:01:35,700 Nothing happened because I uploaded I've uploaded the working stable code to GitHub, which it sits 20 00:01:35,700 --> 00:01:39,900 there safe and sound with nothing can happen to it. 21 00:01:40,140 --> 00:01:45,570 And the corrupted code will appear only at the programmers computer specifically. 22 00:01:45,930 --> 00:01:55,260 And by using GitHub, I can revert the code to that programmers computer to the stage where it when 23 00:01:55,260 --> 00:01:56,190 it was working. 24 00:01:56,470 --> 00:02:03,570 OK, so if someone off the team of programmers corrupts the code, he can always revert back to the 25 00:02:03,570 --> 00:02:05,640 time where the code was working. 26 00:02:05,880 --> 00:02:10,020 And that working code we're going to see it is going to see it in GitHub. 27 00:02:11,010 --> 00:02:13,200 So it's pretty easy, right? 28 00:02:13,200 --> 00:02:18,420 So GitHub basically serves us same as Google Drive, but for coding. 29 00:02:18,660 --> 00:02:19,080 All right. 30 00:02:19,350 --> 00:02:20,700 So let's begin with a slide. 31 00:02:20,700 --> 00:02:24,120 And for that, I need to turn off the camera and let's begin. 32 00:02:25,650 --> 00:02:26,060 All right. 33 00:02:26,070 --> 00:02:31,440 So basically, GitHub is work, same as Google Drive just for code. 34 00:02:31,680 --> 00:02:37,770 Once having our code on GitHub cloud, it is safe from being corrupted or deleted on our local machine. 35 00:02:38,610 --> 00:02:44,310 Then as a ninja developer, our main mission is to keep the existing working code safe. 36 00:02:44,610 --> 00:02:51,690 GitHub allows us to use git commands, which you're going to see in the following next year to keep 37 00:02:51,690 --> 00:02:53,820 our code controlled and managed. 38 00:02:54,720 --> 00:02:57,300 In this section, we're going to learn the following thing. 39 00:02:58,440 --> 00:03:03,690 We're going to create a new GitHub account, then create a new repository on GitHub. 40 00:03:03,690 --> 00:03:09,780 Basically, a repository is like a folder on the cloud of GitHub. 41 00:03:09,810 --> 00:03:15,060 OK, so the repository is a folder of our project on the cloud. 42 00:03:15,900 --> 00:03:20,550 So we're going to create a new repository on GitHub and upload our existing project. 43 00:03:21,990 --> 00:03:26,730 So first of all, go over to gate half.com and open a new account. 44 00:03:27,000 --> 00:03:30,900 I'm going to open incognito because I've already opened an account. 45 00:03:32,280 --> 00:03:39,480 And once you go here, just click on sign up and go through a normal registration process. 46 00:03:41,800 --> 00:03:51,070 Once you do verify your account by clicking on the link that you get from GitHub to your email, then 47 00:03:51,070 --> 00:03:57,310 once you are signed in and verified your account, OK, once you're sending, you're going to see this 48 00:03:57,310 --> 00:04:02,350 screen and you can see here that I'm already signed in and everything's OK. 49 00:04:04,050 --> 00:04:09,360 Then please download GitHub Dotcom and install it, it's a desktop program. 50 00:04:10,510 --> 00:04:18,160 All right, once it's installed, we're going to do the process of connecting between GitHub account 51 00:04:19,090 --> 00:04:21,160 and GitHub desktop program. 52 00:04:21,680 --> 00:04:25,000 OK, so let me just open GitHub desktop. 53 00:04:25,030 --> 00:04:25,860 There it is. 54 00:04:26,530 --> 00:04:31,930 And from here, I'm going to sign into my account. 55 00:04:32,530 --> 00:04:37,150 So I have automation ninja user. 56 00:04:37,280 --> 00:04:45,010 OK, by the way, I clicked file options and then I had the signing button automation ninja user and 57 00:04:45,010 --> 00:04:47,750 the password is all right. 58 00:04:48,100 --> 00:04:48,760 It worked. 59 00:04:49,540 --> 00:04:52,750 So no one's going to file an options. 60 00:04:53,020 --> 00:04:55,470 I can see my account signed in right here. 61 00:04:56,110 --> 00:04:56,640 All right. 62 00:04:57,520 --> 00:05:01,840 Now what I'm going to do is I've already created a repository. 63 00:05:01,870 --> 00:05:05,340 So just wait just one second, OK? 64 00:05:05,380 --> 00:05:06,400 Once you're signed in. 65 00:05:06,430 --> 00:05:06,760 Yeah. 66 00:05:06,790 --> 00:05:07,720 This is the screen. 67 00:05:08,050 --> 00:05:11,420 Once you're signed in, you will see the following screen, this screen. 68 00:05:12,280 --> 00:05:17,740 Now, what I'm going to do is, is to click on this button right here at an existing repository from 69 00:05:17,740 --> 00:05:18,630 your hard drive. 70 00:05:19,060 --> 00:05:24,670 Basically, I'm going to take the project that we have been working on since the beginning of the course 71 00:05:25,510 --> 00:05:31,420 and point out to GitHub, the file, the folder that I would like to upload to the cloud. 72 00:05:32,080 --> 00:05:39,640 So clicking on this last button right here and pointing out to the parent folder of our project. 73 00:05:43,540 --> 00:05:44,530 All right. 74 00:05:46,020 --> 00:05:46,980 Where is it? 75 00:05:48,100 --> 00:05:56,050 Yeah, here is so I'm basically selecting this Python training folder, which is the parent folder of 76 00:05:56,230 --> 00:06:02,320 our project that we've been working on since the beginning of the course select. 77 00:06:03,610 --> 00:06:10,930 And so and once I selected it, I have here a small hyperlink, which is WeChat, which says create 78 00:06:10,930 --> 00:06:12,070 a repository. 79 00:06:12,230 --> 00:06:17,230 OK, so I'm just going to click on it and then I create a new repository. 80 00:06:17,230 --> 00:06:18,370 Screen would open. 81 00:06:19,570 --> 00:06:23,110 I have here the name of the project, the description. 82 00:06:28,580 --> 00:06:34,820 And here I have the local bath, which points out to the folder of the project, click the check box 83 00:06:34,820 --> 00:06:39,080 of initialise readme file and click create a repository. 84 00:06:41,380 --> 00:06:47,980 What happened now is that we have created a repository right here, we can see the current repository, 85 00:06:47,980 --> 00:06:54,690 python training, and this repository currently is on our local machine, on our PC or Mac. 86 00:06:55,360 --> 00:06:58,930 It was yet to be published in GitHub Cloud. 87 00:07:00,070 --> 00:07:04,090 We're also currently on our main branch. 88 00:07:04,370 --> 00:07:09,810 OK, this topic, remember it branches will be discussed in the following lecture. 89 00:07:10,270 --> 00:07:16,870 But for now, just remember that we are in on our main branch right here. 90 00:07:16,880 --> 00:07:20,950 The third button to the right, we're seeing the button publishers repository. 91 00:07:21,220 --> 00:07:27,220 Basically, once we're clicking on this button, the project that's on our local machine will be published 92 00:07:27,220 --> 00:07:28,630 in GitHub Cloud. 93 00:07:28,630 --> 00:07:29,560 So let's click on it. 94 00:07:31,330 --> 00:07:33,400 All right, publisher repository. 95 00:07:38,060 --> 00:07:43,820 And you can see right here, this is being published right now, fetching a region. 96 00:07:43,830 --> 00:07:44,660 Hang on. 97 00:07:45,860 --> 00:07:57,210 All right, so now basically our project in the local folder, OK, where we have created our project. 98 00:07:57,890 --> 00:08:00,260 Let me just bring it from my other screen. 99 00:08:12,480 --> 00:08:13,470 Just a second. 100 00:08:18,880 --> 00:08:21,590 Oh, yeah, here it is. 101 00:08:22,090 --> 00:08:30,160 Yeah, so this project right here is in sync with the guitar becloud. 102 00:08:30,190 --> 00:08:37,630 OK, so we basically took this folder with all of these classes, all of these modules that we have 103 00:08:37,630 --> 00:08:43,090 created and we have selected whatever we have here with our GitHub cloud. 104 00:08:43,400 --> 00:08:43,960 All right. 105 00:08:44,620 --> 00:08:51,340 And also now I'm going to show you how these three. 106 00:08:52,220 --> 00:08:58,530 All right, we have GitHub and we have by charm and we have our local folder. 107 00:08:59,080 --> 00:09:01,030 All these three are connected. 108 00:09:02,710 --> 00:09:03,270 All right. 109 00:09:03,670 --> 00:09:07,090 So I'm going to show you this by the following way. 110 00:09:07,300 --> 00:09:08,680 OK, so pay attention. 111 00:09:13,510 --> 00:09:15,690 This is by charm, and this is my project. 112 00:09:15,700 --> 00:09:19,750 All right, right here, I'm going to add the following line. 113 00:09:19,750 --> 00:09:24,410 I'm going to add print, then ABC. 114 00:09:25,270 --> 00:09:25,720 All right. 115 00:09:25,720 --> 00:09:31,360 I have added this print action command action to the project, which was not here earlier. 116 00:09:31,990 --> 00:09:34,690 And I'm going to open GitHub desktop. 117 00:09:35,260 --> 00:09:43,060 And you can see here that I have removed the print X, X, X, and I have added the print ABC to our 118 00:09:43,060 --> 00:09:43,690 project. 119 00:09:43,930 --> 00:09:47,920 So whatever line I have removed, I have removed this line. 120 00:09:48,760 --> 00:09:54,720 And this is the line that I've added to the project are all mentioned here inside GitHub desktop. 121 00:09:54,970 --> 00:10:04,180 And if I go to a different file, OK, let's go to oh maybe here now and here I can put print. 122 00:10:05,960 --> 00:10:13,610 Best going back to your desktop, so you can see here as well the changes that I've made in the project, 123 00:10:13,970 --> 00:10:17,060 both of these are mentioned here as single records. 124 00:10:17,270 --> 00:10:20,780 And in here you can see green, the lines that I've added. 125 00:10:20,780 --> 00:10:25,280 And in here you can see in green here and in red, you can see the lines that have been removed. 126 00:10:26,210 --> 00:10:28,970 OK, so GitHub sees these changes. 127 00:10:29,120 --> 00:10:34,370 And let's for let's say, for example, that this change I don't want to push GitHub cloud. 128 00:10:34,700 --> 00:10:35,030 Right. 129 00:10:35,030 --> 00:10:41,090 Click on it, discard, discardable, abort the changes immediately. 130 00:10:41,480 --> 00:10:43,610 And you can see here. 131 00:10:43,940 --> 00:10:44,540 All right. 132 00:10:44,720 --> 00:10:48,620 You see here at the right, the test command. 133 00:10:48,920 --> 00:10:50,960 And once I'm going to push. 134 00:10:50,960 --> 00:10:52,700 Right, click on it and discard. 135 00:10:55,660 --> 00:10:59,010 OK, this command disappeared, OK? 136 00:10:59,320 --> 00:11:06,400 It disappeared because I told Kitab, please ignore this change and as I just just said, pie, charm 137 00:11:06,610 --> 00:11:12,150 and guitar, dotcom cloud and our local folder are all connected. 138 00:11:12,370 --> 00:11:17,420 So once I click here, discard it, basically told Kitab, ignore this line. 139 00:11:17,590 --> 00:11:23,460 So also pie chart removed that line and now we're going to made some changes. 140 00:11:23,470 --> 00:11:24,340 All right, print. 141 00:11:24,670 --> 00:11:25,150 You know what? 142 00:11:25,150 --> 00:11:31,540 Let's just make some small changes so we won't mess up our existing files. 143 00:11:31,720 --> 00:11:34,760 Just I removed your space. 144 00:11:34,780 --> 00:11:35,230 All right. 145 00:11:36,700 --> 00:11:43,180 Also, you can see here the changes of removing the space and you can see here the record, and I'm 146 00:11:43,180 --> 00:11:50,790 going to leave a small note here, OK, small changes made, space was removed. 147 00:11:50,800 --> 00:11:51,250 All right. 148 00:11:51,760 --> 00:11:54,400 And now we're going to do two simple steps. 149 00:11:54,700 --> 00:11:55,390 We're going to click. 150 00:11:55,390 --> 00:11:57,620 This commits to me, OK? 151 00:11:57,940 --> 00:12:03,270 Comet made the change sort of go into hold. 152 00:12:03,340 --> 00:12:06,040 OK, it was yet to be pushed to the cloud. 153 00:12:06,160 --> 00:12:09,790 It's now on hold, but it was not yet to be pushed. 154 00:12:10,330 --> 00:12:13,360 And now we have this button right here, push origin. 155 00:12:13,930 --> 00:12:15,400 And you can see no one here. 156 00:12:15,580 --> 00:12:21,520 And you can see one indicator that we made only one change here and we're going to push this change 157 00:12:21,520 --> 00:12:22,330 into the cloud. 158 00:12:22,360 --> 00:12:27,880 OK, so clicking Bush, we have pushed the change into the cloud. 159 00:12:28,000 --> 00:12:28,440 OK. 160 00:12:32,470 --> 00:12:33,940 So that's about it. 161 00:12:34,720 --> 00:12:42,370 We have pushed the change into the cloud and now they are all synched together and also we're going 162 00:12:42,370 --> 00:12:46,420 to have a look on what we have, what we are having on the cloud right now. 163 00:12:47,830 --> 00:12:51,440 Let's try to find argued Fab.com account. 164 00:12:51,850 --> 00:12:52,720 There it is. 165 00:12:53,160 --> 00:12:56,520 OK, so one's going to our account. 166 00:12:56,530 --> 00:12:57,750 This is the main page. 167 00:12:58,200 --> 00:13:01,510 Yeah, this is the main page of the account. 168 00:13:01,660 --> 00:13:06,190 You can see how that commenter mentioned in your user going to repositories. 169 00:13:07,270 --> 00:13:08,640 This is our folder. 170 00:13:08,650 --> 00:13:13,580 I want to become a ninja developer and this is our project. 171 00:13:13,840 --> 00:13:18,160 OK, so in here you can see all the changes that were made. 172 00:13:19,060 --> 00:13:21,900 Basically, the changes here indicate what time they were made. 173 00:13:22,210 --> 00:13:25,320 Basically, all these changes are the push that we have made. 174 00:13:25,660 --> 00:13:28,570 And in here we can see space removed. 175 00:13:29,260 --> 00:13:32,060 OK, small change made, space was removed. 176 00:13:32,080 --> 00:13:34,600 This is what we just wrote in GitHub desktop. 177 00:13:35,290 --> 00:13:35,800 All right. 178 00:13:36,160 --> 00:13:38,270 And here is all of our code. 179 00:13:38,340 --> 00:13:46,450 OK, so the reasoning that we have is GitHub is to, for example, let's say that we have created lots 180 00:13:46,450 --> 00:13:47,610 of lots of files here. 181 00:13:47,830 --> 00:13:53,230 We've created a whole program that runs sync synched together and everything was fine. 182 00:13:54,370 --> 00:13:59,050 And then we have some team members that made some changes and left the code like this. 183 00:13:59,050 --> 00:14:00,390 And we have an error here. 184 00:14:00,670 --> 00:14:07,120 OK, and this error appears only on this local machine of this developer. 185 00:14:07,420 --> 00:14:09,690 And we want to keep our project safe. 186 00:14:10,150 --> 00:14:19,060 So basically, there is going to be a person that will check the code of that developer and after only 187 00:14:19,060 --> 00:14:20,650 after he will check it. 188 00:14:21,220 --> 00:14:25,750 This guard person does this like senior developer. 189 00:14:25,750 --> 00:14:33,130 After checking the code of its co-worker only, he will upload the code to GitHub. 190 00:14:33,340 --> 00:14:39,880 So you're going to have some gatekeeper over your code before uploading it to the branch. 191 00:14:41,020 --> 00:14:50,620 And this is how you keep your project safe from errors, because if you are going to upload a code with 192 00:14:50,620 --> 00:14:55,480 an error like this into your cloud, then you are done. 193 00:14:55,480 --> 00:14:56,980 You are on a very bad shape. 194 00:14:57,250 --> 00:15:06,040 So GitHub is basically like a mid stage between the local code that I'm writing here in my computer. 195 00:15:06,670 --> 00:15:14,230 Then you're going to have a person that will check the code before uploading it to the GitHub account. 196 00:15:14,380 --> 00:15:21,800 And the GitHub account always must be a stable working version without any errors. 197 00:15:22,210 --> 00:15:23,620 So this is the safe zone. 198 00:15:23,620 --> 00:15:30,520 The hab cloud is the safe zone, and this is the tool that we're going to use to control our code between 199 00:15:30,520 --> 00:15:33,040 our local machine and our cloud. 200 00:15:33,610 --> 00:15:34,180 All right. 201 00:15:34,360 --> 00:15:36,910 I will continue this topic in the following lecture. 202 00:15:36,910 --> 00:15:37,990 Thank you and bye bye.