-
Notifications
You must be signed in to change notification settings - Fork 0
Video Script & Demo: Creating a GitHub Pull Request on a MacBook (Explained for Beginners & Non‐Developers)
I split this content into a short prerequisite explainer and a main walkthrough to reduce cognitive load and let viewers self-select based on their experience.
Watch Time: 3 Mins
Read time: 1 min
0:01: Hello. Before we jump into creating a pull request on GitHub, there are a few things you need to set up, of course.
0:08: So, this video is basically a quick walk through of those prerequisites for a GitHub beginner. So, the first thing you need, of course, is a GitHub account.
0:16: And to set that up, all you need to do is search GitHub on your browser and click on the sign up option. Follow the instructions and you would have successfully created your very own GitHub account. The next thing you'll need is to install Git on your computer.
0:36: Git without the Hub. And basically what Git is is that it lets your local files communicate with GitHub and it helps you track changes and send these changes back and forth.
0:52: So, of course, all you need to do is search Git in your browser and click on the install option. You will see different installation instructions for different operating systems.
1:03: So, all you need to do is click on the one that applies to you. If you use Mac OS, you can install Git from your terminal by using Homebrew, but you can only use Homebrew if you have it installed on your system already. So to check if you have homebrew installed, go to your terminal.
1:22: Um you can do this by pressing command + spacebar on a MacBook and searching for terminal clicking on it and your terminal is open now. So to check if you have homebrew, type in brew help and press enter.
1:44: If you get a response like this, then it means that you have homebrew installed on your system. But if you get a command not found response, then you do not have homebrew installed on your system.
1:57: Now to install homebrew, all you need to do is search homerew on the web as well. Click on the first result and it brings you to this page. Um, there's a script for you to copy and then paste that script in your terminal and press enter and brew will be installed on your system.
2:18: After installing Homebrew, you can come back here and simply copy this um, paste it in your terminal and press enter and Brew will install Git for you on your system.
2:36: Finally, the last thing we'll be needing is a code editor. And for this demo, I will be using Visual Studio Code, VS Code, and I recommend it as well.
2:47: But the same idea applies if you're using any other editor. To install VS Code, all you need to do is come to your browser as usual, type VS Code, and click on the download option.
3:01: You will see different packages for different operating systems and you just need to select the one that applies to you and you would have successfully installed Visual Studio Code on your system.
3:16: Now once all these pieces are in place, we can focus on creating our pull request on GitHub.
Watch time: 14 mins
Read Time: 8-9 mins
0:00: Hello. In this video, I will be explaining what a pull request is and how you can create one as a beginner or a non-developer on GitHub.
0:08: Um, so the first thing you need to know is that a pull request is a way to propose changes to a codebase on GitHub.
0:15: Code bases are stored in repositories on GitHub. If you don't know what a repository is, um you can just click on the nav bar and click on
0:24: explore and you will see a list of trending repositories on the right side of your screen which is here.
0:31: You can click on anyone and you will be inside a repository.
0:37: Voila. So um a pull request allows you to propose updates, changes or additions to this and the admin gets to decide whether to merge your pull request with the main or master branch
0:55: or they could reject it. They could suggest edits to your proposed addition.
1:01: They could make comments on it, you know. So pull requests sort of are a way to allow collaboration without necessarily
1:11: destroying or being able to edit the master branch, the production branch of a software project.
1:20: Because if everyone can edit the main branch of a project, then it can have serious implications on you know real life systems that are running.
1:34: For the purpose of this demo, I will assume that you already have a GitHub account, of course, and that you have Git and VS Code installed on your system.
1:42: If you don't, please watch my prerequisite video where I explain the things you need to set up before you can create a pull request on GitHub.
1:49: Now, like I said, you can for the purpose of learning, you can use any, you know, of the repos you find in your explore page.
1:57: I already have a repository in mind to use. So I will be using um um this repository right here.
2:08: So um the first thing you will want to do when you open the repository that you want to contribute to is to click on fork. Now what fork does is basically creates a copy of the repository to your GitHub uh profile. Now, I've already forked that repository as you can see.
2:28: So, this is the repository, my copy of it. Um, so the next thing you're going to want to do is click on code here and then copy the URL to this repository.
2:38: Now that we have done that, we need to open our terminal to run some commands.
2:45 Um, to open your terminal, you press command and the space bar and then search terminal and then, you know, you just open it. Um so if you are not familiar with using your terminal, terminal is sort of a an interface you can use to communicate directly with your operating system.
3:06: You can you can create files via your terminal. You can open documents via terminal. You can do a whole lot of things via your terminal. And so what we're going to be doing is basically finding a location to store the repository that we have.
3:24: So we've copied the link of the repository from GitHub and we're going to be cloning it to our local system. So sort of downloading it to our local system.
3:33: So what I'm here to do right now in this um terminal is to find a location or select the location that it will be stored.
3:44: In order to you know select a location a directory um you type in the prompt cd in your terminal and then you can select your documents, downloads or whatever directory or folder you decide to store this code base in.
4:04: So I will be choosing documents and pressing enter. And as you can see now, we have moved into my documents directory. That's where we're working in right now.
4:17: So now you click type the command git clone and then paste the URL that we copied earlier. And when you press enter, what it does is that it basically clones the repository to your local system. Sort of downloads it to your local system.
4:36: Now if I go to my documents, if I go to my documents, you will see the folder system monitoring here and these are all the you know the files within it as you can see.
4:53: So now that we have done this, the next thing you need to do is to open VS Code, Visual Studio Code. In VS Code, um what you're going to want to do is to Click on file and click open folder.
5:09: Now you will navigate to the location of the folder that was stored you know after you cloned the repository in your terminal. So you're going to navigate to that folder and click on open. It's already open here.
5:28: It's already open in my um VS Code. But if it's not open, you know, you click on open and then it brings you here and then what you need to do is click on terminal, then click on new terminal and then it opens the terminal part of VS code where you can type in commands.
5:55: Um, so now we need to just confirm which branch of the repository that we're in. So I'm going to just type um git branch and then it shows that I am in the master branch. So I'm in the master branch of the cloned or the forked repository.
6:24: I'm not in the master branch of the of the original repository.
6:29: Bear that in mind because I don't have access to the master branch of the main repository. Um now I'm going to create a new branch where I will make the change that I want to make.
6:39: To create a new branch, you need to type the command git check out -b and then you name your new branch whatever you want to name it. Now, this particular project has a naming convention. If you want to create um add a code enhancement, this is the convention for naming your branch.
7:05: So,I'm going to be basically just following that um enhancement slash I will say um docs updates. Yeah. And so now I'm in docs updates.
7:27: Now inside doc update I am going to create a directory called docs. So to create a directory name docs I will type mkdir which as you can see makes directories. mkdir.
7:46: And then, I will name the directory document and as you can see it has appeared here document. I've made the document um folder.
8:05: I will now navigate into the document folder by typing the same command that I typed in the terminal - cd cd documents.
8:18: And now I'm inside the document folder. And now I will create a file within the folder which is the addition that I'm making to this project system monitoring. To create a file you type the prompt touch and then the file name.
8:36: So I will be naming the file instructions.md. MD is an extension for markdown. So now as you can see inside of documents there's a new file called instructions.md
8:55: When I click on it I have a an editor for markdown and I can write markdown in this editor. So um I will just type something random like this is a heading. I will start a list now and then start a list
9:21: One two three. Okay.
9:29: Now that this is done, I will come here and navigate back to the directory that I was in earlier, which is system monitoring by typing the prompt cd dot dot.
9:50: And now I'm back to system monitoring as you can see. The next thing I will do is to save. Now I need to save this by pressing Ctrl S. And then I will come to my terminal and type the prompt git add dot.
10:12: And what that does is that it basically saves the changes that I've made in this file over here. It saves it to the system monitoring, you know, the system monitoring document.
10:34: So now to check what is up with the system monitoring document you type git status and you can see that there is a new file. It shows that there are changes that need to be committed. You can see that there is a new file named document um the folder is document and then the file inside is instructions.md.
10:56: And now all that is left is to commit the change. Committing the change is basically pushing it to GitHub. Um, so to do this you type git commit -m and you can add a message like updating, updating instructions for repo. You have to put those in quotations by the way. And then very last command we will be typing is git push origin.
11:39: And then the name of the new branch that we created. And what this does is basically pushes everything that we've done the new document you know the updated system monitoring document. It pushes it to GitHub. So pushes.
12:04: So git push origin and then the name of the new branch that we created here in enhancements forward/docs update and then so what this does is this creates yeah, creates a pull request.
12:36: Um, so now you can see if you come back to your GitHub that it will ask you, I've pushed it to my GitHub repo. The changes I made on my local computer,
12:51: I've pushed them to my repo. And so now you can see you have the option of creating a pull request here. And what the pull request will do is that when you click on compare and pull request, you'll see that I created this is the name of the branch that I created here.
13:09: And this is the my version of this repository that I forked. And so this is actually the master branch of the original repository that I am trying to push the change that I've made here into.
13:27: And so in order to push this change into this, I will create a pull request. Then the admin of the repository can go through my pull request and decide whether or not to approve the pull request.
13:46: Finally, if your pull request is merged, that is accepted, then you will get a notification that your PR pull request has been merged into the master branch. And that is basically the end of this demo. Thank you.