Time to time when working on a project using a fork from a git repository, situations arise that a pull request need to be made to the master
repository for a sub set of commits you made to the fork. The following are a set of steps which can help with accomplishing these scenarios.
On the git repository in your local machine created from your fork, create a new branch
git branch cherry-branch origin/master
The assumption is that there is only one branch in your fork and the master repository and origin is pointing to your github fork.
Switch to the new branch created
git checkout cherry-branch
You can verify that you are on the correct branch by running the command
Identify ids of the commits you want to include into the pull request from your github fork.
Issue a git cherry-pick command to include the commits into the new branch
git cherry-pick COMMIT-ID
Push the new branch to your fork
git push origin cherry-branch
On github you can now see the new branch in your fork with only the commits selected. Now a pull request to the master repository.
What if there are multiple branches on the master repository and your fork and you want to send a pull request from a particular branch of your fork
to a branch in the master repository.
Create a clone of the master repository branch you are interested in