Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to cherry pick 2 out of 5 commits of a pull request on GitHub?

I'm new to GitHub. Someone submitted a pull request with 5 commits. 3 of them have a little bug, though, so must wait. How can pick 2 of them for my project?

like image 370
MaiaVictor Avatar asked Mar 21 '13 00:03

MaiaVictor


1 Answers

The ideal solution would be to leave a comment asking for the contributor to submit again his/her pull request with only the 2 commits, in order for you to apply said PR (pull request) without having to do any work.

The other solution, from the page "Merging Pull Request", is to merge locally, on your local clone, in a dedicated branch.
You can then cherry-pick the right commits you want, and push those back to your repo, but make sure to leave a comment in the discussion section of the pull request explaining that

  • you only took 2 of the 5 commits into account,
  • the contributor should rebase his work on top of your new updated master (which now includes said 2 commits), and re-submit the same pull request with the last (and hopefully fixed) 3 commits.

This is similar to the first option, except you don't have to wait for the fixes: you can grab what you want locally, test and push.

like image 164
VonC Avatar answered Oct 05 '22 00:10

VonC