How to Make a Pull Request in Github

29/12/2020
Git
Git is a Version Control System (VCS). GitHub is a collaboration tool built on top of Git. It is also a Git graphical frontend. On GitHub, you can work with many people at the same time on any project. But, to do that, you have to add the required privileges to the people whom you want to make changes to your project.

But what if you do something interesting in a project and want to make changes to a project when you are not privileged to do so? Well, this is where pull request comes in. GitHub pull request is a way to contribute to a project on GitHub even when you don’t have any privileges to make changes to the project. All you have to do is just fork the project, clone the forked project on your computer, make changes, push the changes to the forked repository, and make a pull request to the original project repository. If the owner likes the changes you’ve made, he/she can merge it with the original project. Otherwise, he will be able to remove your request anytime. A very nice feature.

In this article, I am going to show you how to make a pull request in GitHub. So, let’s get started.

Forking GitHub Repository:

To fork a GitHub repository, go to the GitHub repository (that you do not own or have permission to modify) page that you want to contribute and click on Fork as marked in the screenshot below.

The repository is being forked as you can see in the screenshot below.

Once the repository is forked, it should appear with your username as you can see in the screenshot below. This is a copy of the original repository that you forked.

Cloning GitHub Repository:

Now that the GitHub repository is forked, you can make any changes you want here. So, let’s clone it.

To clone the GitHub repository, click on Cone or download and copy the repository URL.

Then, use git clone command to clone the repository on your computer.

$ git clone https://github.com/dev-shovon/toc-generator-plugin.git

The GitHub repository should be cloned.

Making Changes to the Forked Repository:

The repository I’ve forked contains 3 files. demo.html, README.md, toc_plugin.js. I will make a simple change to demo.html and push the change to GitHub in this section.

This is contents the demo.html file.

This is what I get when I run the demo.html file in the browser. Now, let’s change the table of contents (TOC) headers green.

I’ve added a little bit of CSS in the demo.html to make the TOC headers green.

As you can see, the TOC headers are green.

Now, I am going to commit the changes and push it to the forked GitHub repository.

First, navigate to your cloned Git repository as follows:

$ cd toc-generator-plugin/

Now, stage the changes as follows:

$ git add -A

Now, make a new commit as follows:

$ git commit -m ‘changed TOC header color to green’

Now, push the changes to the forked GitHub repository with the following command:

$ git push origin master

You may have to provide the login details of your GitHub account. Once you do, the changes should be uploaded to GitHub.

As you can see, the demo.html file is updated on GitHub.

Creating a Pull Request:

Now, to create a pull request, click on New pull request button as marked in the screenshot below.

Now, make sure the base repository, base branch and your forked repository information is correctly set. Once you’re done, click on Create pull request as marked in the screenshot below.

Type in your comments on this pull request so that the development team knows what you’re trying to do. Once you’re done, click on Create pull request as marked in the screenshot below.

The pull request should be created as you can see in the screenshot below.

Now, the owner of the original GitHub repository will see a new pull request.

 

If the owner wishes to merge the changes to the original project, he/she may do so. To merge the changes, he/she would have to click on Merge pull request.

Then, confirm the merge request by clicking on Confirm merge.

Once the owner confirms the merge request, the changes should be merged to the original GitHub repository.

As you can see, the demo.html file is updated in the original repository.

So, that’s how you make a pull request in GitHub. Thanks for reading this article.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

GitLab Runner and GitLab CI

What is Continuous Integration (CI)? Continuous Integration is the next logical step after have a version control system...
28/12/2020

22 Essential Git Commands

Git has become the quintessential version control system. The rise of Git’s popularity can be attributed to its speed,...
29/12/2020

Git Compare Two Branches

Almost all version control systems have branching options. But Git is known for its fast branching capabilities. Git branches...
28/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

SỰ KHÁC BIỆT GIỮA RESIDENTIAL PROXY VÀ PROXY DATACENTER
17/02/2024

Mua Proxy v6 US Private chạy PRE, Face, Insta, Gmail
07/01/2024

Mua shadowsocks và hướng dẫn sữ dụng trên window
05/01/2024

Tại sao Proxy Socks lại được ưa chuộng hơn Proxy HTTP?
04/01/2024

Mua thuê proxy v4 nuôi zalo chất lượng cao, kinh nghiệm tránh quét tài khoản zalo
02/01/2024