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.

Merging directly on GitHub

If the merge will not have any conflicts, you can merge the pull request online without ever typing a single git command.

  1. Open the pull request's page
  2. Click the "Merge pull request" button Merge pull request button
  3. Enter a commit message Commit message field
  4. Click "Confirm Merge" Confirm button

Merging locally

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.

  1. Click the command line text to the left of the merge button Merge pull information message
  2. 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:

  1. Open your local repository in the terminal
  2. Check out the branch you wish to merge to

    git checkout master
  3. Pull the desired branch from the other user's repository

    git pull https://github.com/octocat/repo.git branchname
  4. Resolve any conflicts and commit the merge

  5. Review the changes and ensure they are satisfactory

  6. Push the merge to your GitHub repository

    git push origin master

Related Topics

Tidying up Pull Requests