Introducing GitHub Repositories: Merging a Pull Request

After you have all your changes in a pull request (see the preceding section), you can merge those changes into the master branch by following these steps:

  1. On the main Code tab, click the View #1 button to get to your pull request.

My pull request page, shown in Figure 3-11, has three different commits. The original one is when I added my headshot to my repo. The next one is when I added the new text to my README.md file, and the third is when I added my headshot to my README.md file. (If you haven’t added these items and would like to, see the section “Modifying README.md”, earlier in this chapter.)

  1. Click the Files changed tab to see all the changes made to this repo.

Files that appear in red will be deleted, while the lines in green will be added.

  1. (Optional) To change the way you see the diff, click the Diff Settings drop-down list and then click Split then Apply and reload.

If you split the view, your screen changes (see Figure 3-12).

  1. In the Conversation tab, scroll to the bottom of the pull request and click the big green Merge pull request button.

The Confirm merge dialog box replaces the section with the Merge button from Figure 3-12, as shown in Figure 3-13.

  1. Click Confirm merge.

You see a message that your pull request merge was successful, with an option to delete the branch (see Figure 3-14).

  1. Click Delete branch.

Your pull request is merged, and the branch is deleted. Don’t worry, if you need that branch back for some reason you can restore it. It’s nice to keep things tidy within the repository.

  1. Click the Code tab to go to your code.

You see the master branch with your picture and the changed README.md file.

Source: Guthals Sarah, Haack Phil (2019), GitHub for Dummies, Wiley.

Leave a Reply

Your email address will not be published. Required fields are marked *