This guide describes how to use a merge commit to combine the changes from a Pull Request (PR) into a branch on GitHub.

Note: This guide assumes you’ve an open GitHub PR that contains the changes you want to merge, and that you know the number of the GitHub PR you’re merging.

Topics in this guide

Examples of when to use a GitHub merge commit

This topic provides examples of when to use a merge commit to merge a GitHub PR.

When all your file changes are implemented, and you’ve opened a GitHub PR for your changes, the files in the GitHub PR must be merged back into the originating branch (like the master branch) using a merge commit.

The following are examples of when to use a merge commit to merge a GitHub PR.

Authors

As part of the content authoring process, an author might create a new authoring branch from the master branch. When the author has finished developing content, the changes applied to the files on the authoring branch must be merged back into the master branch. The author pushes the files on their authoring branch “up” to GitHub, and then a GitHub PR is created to request merging the authoring branch back into master. When the proposed file changes within the GitHub PR have been approved by a GitHub reviewer, the contents of the GitHub PR are combined with the contents of the master branch using a GitHub merge commit.

Reviewers

During the review process, a reviewer might modify an author’s content. To compartmentalize the reviewer’s changes, the reviewer might create a reviewer’s branch based on the originating author’s branch. When the reviewer has finished making changes, the reviewer’s branch must be merged back into the originating author’s branch. A GitHub PR is created to request combining the reviewer’s branch with the originating author’s branch. When the changes have been approved by a GitHub reviewer, the contents of the GitHub PR are combined with the contents of the originating author’s branch using a GitHub merge commit.

Note: Beyond the examples cited in this guide, the steps described in Merge a GitHub PR can be applied to combine files from a GitHub PR with files on a branch (like master) using a GitHub merge commit.

GitHub merge commit operations are usually performed by a designated Waypoint team member who is responsible for merging GitHub PRs. Your project manager can identify the appropriate Waypoint team member for you.

Merge a GitHub PR

This topic describes how to merge a PR into a branch using a merge commit on GitHub.

When a GitHub PR is ready to be merged, the person who created the PR must send an email to the Waypoint team member responsible for merging GitHub PRs.

The email must state the following information:

  • Module number. The number of the module/ unit that the GitHub PR to be merged relates to.
  • Task type. The task performed on the files in the PR (for example, ID review, content authoring, etc.).
  • GitHub PR number. The number of the GitHub PR to be merged.
  • Merging branch name. The name of the branch the files are being merged from (for example, the name of your author’s/ reviewer’s branch).
  • Target branch. The name of the branch the files are being merged into (for example, master or the name of an originating author’s branch).
  • Confirmation. Confirmation that all file changes have been implemented, the files have been reviewed, and the PR is ready to be merged into the originating branch.

The Waypoint team member responsible for merging GitHub PRs will perform the GitHub merge commit by completing the following actions:

  1. In a web browser, sign into GitHub, and go to the project’s GitHub repository (remote repo).

    For example, in the following image, the repo (test-repo) is open on GitHub.

    Example GitHub repo in a web browser

  2. Select the Pull requests tab.

    GitHub 'Pull requests' tab

  3. From the list of open PRs, choose the PR to be merged.

    Example PR selected in the GitHub 'Pull requests' tab

  4. In the Conversation tab, scroll down to the dropdown Merge pull request.

    GitHub conversation tab with 'Merge pull request' button

  5. Verify the presence of the message This branch has no conflicts with the base branch.

    The 'no conflicts' message in the GitHub conversation tab

    Note: If GitHub indicates that there are merge conflicts, follow the guide Resolve merge conflicts, and then try merging the PR again.

  6. Set the dropdown option to Create a merge commit.

    GitHub conversation tab with 'Create merge commit' option

  7. Select Merge pull request.

    GitHub 'Merge pull request' button

  8. Choose Confirm merge to confirm the merge action.

    GitHub 'Confirm merge' button

  9. When the merge is complete, verify the presence of the message Pull request successfully merged and closed, and then delete the merged branch by selecting Delete branch.

    GitHub 'Pull request successfully merged' message and 'delete branch' button

    Note: GitHub will notify the contributors assigned to the GitHub PR that the PR has been merged.

You’ve merged a PR into a branch using a merge commit on GitHub successfully.

Appendices

Check the following supplementary Appendices for more details and context.