Practice Submitting Pull Requests

A pull request from a branch allows collaborators to suggest changes to a repository on GitHub that can be easily reviewed by others in the project. Learn how to create branches and submit pull requests on GitHub.com to suggest changes to a GitHub repository.

Learning Goals:
  • Define branches in GitHub repositories
  • Submit a pull request of changes to a repository on GitHub.com.
Authors

Leah Wasser

Jenny Palomino

Max Joseph

Elsa Culler

Published

June 4, 2024

In this lesson, you will learn how to submit a pull request to suggest changes to a repository you are collaborating on.

You will need a web browser and your GitHub.com login (username and password).

For this assignment, you will add information about your GitHub username and, optionally, your personal website to a repository.

Step 1: Navigate to the repository where you will add your username and other information.

For the first Data Short Course (starting 2024), we will be using our syllabus repository.

Make sure to navigate to the Code tab.

Step 2: Make your changes

  1. Click on the README.md file.
  1. Then, click on the edit button in the upper right.

    Click the edit button.
  2. Add a row to the directory table with any of the following information you are comfortable sharing:

    • Your name, linked to a pronounciation link. We recommend that everyone use these even if your name is “easy to pronounce” because pronounciation difficulty always depends on the language of the speaker.
    • Your GitHub username, linked to your GitHub profile page https://github.com/<your-username>
    • Your personal website or a social media profile, linked to itself.
    • Your LinkedIn profile, linked to itself (optional)

    At the end it should look like: Added a row to a table with Markdown

  3. Select the Commit button.

    Select Commit.
  4. Make sure to select Make changes in another branch. This will create a branch with your changes in it! You can name the branch anything you want other than main, but the default (<your-username>-patch-1) is fine.

    Select Make changes in another branch.
  5. Write a message, including your username, so that the adminstrators can identify what the pull request is doing easily. You can add additional details in the description if you like, but the message is the most important part since that is what will be visible in the list of Pull Requests.

  6. Click the Propose changes button.

    Select Propose Changes.

Pull Requests allow you to suggest changes without changing the “default” version of a repository (typically the main branch)

A pull request:

  1. Allows others to review your changes and suggest corrections, additions, edits, etc.
  2. Allows repository administrators control over what gets added to their project repo.

The ability to suggest changes is a powerful feature of GitHub. You can make as many changes as you want, and then suggest that the project manager or owner incorporate those changes using a pull request. When you make additional changes in your branch, they will get added to your pull request automatically until it is merged in. Then you will need a new branch and a new pull request.