How to Pull Requests on GitHub

André Rosa
Sep 22 · 3 min read

Today, I pulled a request with the right technique used to propose changes and fixes to Open Source projects. To do so, I used as a lab rat my friend Sukhbeer’s repository.

A brief overview on how to make a Pull Request:

1) From GitHub page, fork the original repo;

2) Clone the newly created forked repo to your local desktop machine;

3) On GitHub, in original repo, I created an ‘issue’ describing the fix/improvement I want to code. My issue had the number #2;

4) Back to my desktop I added the original source as a remote with the command:

git remote add upstream <original source>

To check the current remotes type: git remote -v

You will have two remotes: your repo and the original repo.

5) Still in the local desktop create a ‘branch’ to commit changes. The branch receives the number of the issue created on the item 4) above;

git checkout -b “issue-2”

6) code the solution and test it.

7) Now add the changes to the local stage area with:

git add <changed file>

8) Commit the changes to your branch (check the current branch with ‘git status’). Remember to add to the comment the number of the issue solved.

git commit -m “Issue #2: added …..”

9) Push your changes to the branch on GitHub with:

git push origin issue-2

Now you can check the changes in your forked repo on GitHub page.

10) The final step in the GitHub page. In your forked repo click the button “Compare and Pull Request”. There you can add your comments and send your proposed changes to the original repo’s owner.

Good Work!

OSD600 Release 01

After understanding the process of pull requests, I started to work in the Release 01 from OSD600.

  1. Code Improvement

As a code improvement I selected Robert Begna’s app located in:

There I added a Button to allow saving for those that have trouble with keyboard shortcuts. The idea was to add the line bellow to the code.

<button class=”btn btn-info mt-2" id=”save” type=”button” onclick=”saveFile(true)”>Save</button>

When clicking the button the process will call the method savefile(true) created by the original author, therefore it was not necessary further changes. This improvement was named Issue #8.

2. Code Fix

The next step in the release was to fix a bug in one of the available apps. I selected the repo from Evelyn Yeoung located in:

I noticed that this app had a flaw when the user clicked in the ‘clear’ button. The app did not only erased the notes box but also the title and the footer of the page. Therefore my fix was to avoid the issue #6.

I found out that the problem was quite simple, I just commented two lines of code and the issue #6 was solved. Now the ‘clear’ button only erases the contents in the notes box.

3. Added a Clear Button

The third pull request I did was meant to help a friend that did not had any pull requests. I checked his app and noticed he needed a Clear button. I made the fix and everything seemed fine, however when I was to create the issue I noticed that another friend decided to fix the same problem and had already created the issue. Now it is up to the repo owner to decide which code is better! The pull request is here:

Written by

Computer Programmer

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade