Once a pull request is deemed satisfactory, anyone with push access to the destination repository can perform the merge. There are a variety of ways to accomplish this. Two popular methods are described below.
If the merge will not have any conflicts, you can merge the pull request online without ever typing a single git command.
- Open the pull request's page
- Click the "Merge pull request" button
- Enter a commit message
- Click "Confirm Merge"
If the pull request cannot be merged online, or you wish to test things locally before sending the merge to the repository on GitHub, you can perform the merge locally instead. This is also handy if you don't have push access to the repository.
git pull is the most common method of fetching and applying changes. This method will retain the commit history without modification.
- Click the
command linetext to the left of the merge button
- Follow the instructions displayed for your pull request. Note: these will be different for every pull request
If you do not have write access to the repository, you can still run the commands locally:
- Open your local repository in the terminal
Check out the branch you wish to merge to
git checkout master
Pull the desired branch from the other user's repository
git pull https://github.com/octocat/repo.git branchname
Resolve any conflicts and commit the merge
Review the changes and ensure they are satisfactory
Push the merge to your GitHub repository
git push origin master