How to Complete a Pull Request on GitHub

Β·

2 min read

This quick how-to assumes that you have introductory experience with Git and GitHub. This guide will take you from the beginning of the process to the end.

Note: The commands and screenshots in this guide are using a test repository. Make sure to change the repository names, folder names, branch names, etc., to the repository you're working on.

Fork the repository

  1. Go to the GitHub repository of the project you'd like to contribute to.
  2. Click the Fork button. image.png

Clone the fork

  1. You can copy the link directly from GitHub. image.png
  2. Then paste it into your terminal with the git clone command.
    git clone https://github.com/GarlandKey/test-repo.git
    
  3. Don't forget to change directories!
    cd test-repo
    

Create the appropriate branch

Note: An appropriately configured repository will not accept your pull requests to the main branch. Other naming conventions for the main branch are master and stable.

  1. You can find the appropriate branch listed in the GitHub repository. Standard naming conventions are dev or development. image.png
  2. Create the branch and switch to that branch.
    git checkout --track origin/test-branch
    

Now you're ready to contribute!

If you already have some work in progress, you can now move the files into your new working directory.

  1. Don't forget to commit often and with short but descriptive comments about the work done or changes made.
    git add .
    git commit -m "descriptive comment here"
    
  2. When you're ready to make your pull request, don't forget to push to your fork first.
    git push
    

Complete your pull request

Note: A pull request should be one measurable task, such as refactoring a single function and its tests.

  1. Visit the GitHub repository that you're contributing to.
  2. Click the Pull requests tab.
  3. Click the New pull request button. image.png
  4. Select the correct branch to make your pull request. image.png
  5. Click Create pull request image.png
  6. Add a short but clear title and a verbose description of the changes/additions made, then click Create pull request. image.png

Congratulations! You completed a pull request!

image.png

Being human, we're all prone to mistakes - I am no exception. So if you have any questions or concerns, please don't hesitate to reach out!

Β