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.
Prerequisites
Before you proceed complete the following:
- Install Visual Studio Code
- Install Docs Authoring Pack
- Install Word Count extension
- Install Pull Requests extension
- Install Azure Repos extension
- Install Git client
- Set Git credentials
- Terminology and concepts
- General project workflow
- Download course files (clone repo)
- Project branching policies
- Create new branch in VSC
- Send (push) files
- Markdown syntax guide
- Add/ edit markdown in VSC
- Add/ edit images in VSC
- Fix linter issues
- Pull requests overview
- Create pull request
- Work in a pull request
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:
-
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.
-
Select the Pull requests tab.
-
From the list of open PRs, choose the PR to be merged.
-
In the Conversation tab, scroll down to the dropdown Merge pull request.
-
Verify the presence of the message This branch has no conflicts with the base branch.
Note: If GitHub indicates that there are merge conflicts, follow the guide Resolve merge conflicts, and then try merging the PR again.
-
Set the dropdown option to Create a merge commit.
-
Select Merge pull request.
-
Choose Confirm merge to confirm the merge action.
-
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.
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.