GitHub: Accept Pull Request, But Only Some Commits

Say you’ve got a user who made a few commits and rolled them into one pull request. You want to accept one of the commits, but reject the others. Is this possible with GitHub?

  • git push authentication fails
  • How to create a tag on GitHub when a PR is merged?
  • Resolve Git merge conflicts in favor of their changes during a pull
  • failed to push some refs to
  • How to run pip3+git from behind proxy with docker?
  • Changing branches in git results in changed files
  • Show all files recently committed by me on IntelliJ IDEA
  • git tf configure command error (git-tf nothing to configure)
  • Bzr fast-export return bzr: broken pipe
  • Ansible git module not checking out a branch
  • upstream in git and use of -u flags in push
  • Cycle through several branches with submodules for read only purpose
  • 2 Solutions collect form web for “GitHub: Accept Pull Request, But Only Some Commits”

    Yes, you can manually accept certain commits using git-cherry-pick and then close the pull request.

    Next to the “Merge pull request” button, there should be a “Use the command line” link to instructions on how to do it manually. You should follow these instructions (create new local branch and pull in their changes), but then instead of merging that whole branch back into master, you just cherry-pick the commits you want.

    e.g. to review a pull request from user: jashkenas, in their branch: new-feature

    git checkout -b jashkenas-new-feature master
    git pull new-feature

    And then do your testing, and then when you’re ready:

    git checkout master
    git cherry-pick COMMIT_HASH_1
    git cherry-pick COMMIT_HASH_2
    # etc
    git push origin master
    Git Baby is a git and github fan, let's start git clone.