Selectively taking commits out of a GitHub pull request

Once in a while it’s necessary to get picky and only accept one or more commits from a bundle sent over in a GitHub pull request – or maybe someone’s been working on a fork of a repository of yours and you want to pull a change or two in. The git command cherry-pick is there for this purpose.

To start, you’ll need to run git fetch on the forked repository:

git fetch [email protected]:hakimel/Fokus.git

Next, take the hash of the commit you want to retrieve files for and run the cherry-pick command on it:

git cherry-pick 00988a520bda3e365c74033a44a96941d77be86f

That should do it! Check your git log to see the commit pulled into your repository.

Source: StackOverflow – Pull in changes from a Github fork

Leave a Reply

Your email address will not be published. Required fields are marked *