0 votes
1 view
in Devops and Agile by (28.1k points)

I forked a project on github and am successfully making changes to my local master and pushing to the origin of github. I want to send a pull request, but only want to include the last commit. The pull request UI on github.com shows the last 9 commits and I don't know how to filter that down.

I was trying to understand if I should create a new local branch, check that out and somehow reset or rebase to upstream? Then apply my last commit from my master by id to the new local branch and use that for the pull request?

I'm trying to get the concepts right and figure out the right command lines to do what I need.

1 Answer

0 votes
by (48k points)

In this question, you all need to create a branch and cherry-pick the commits that you want to add.

For that you need to use the following commands:

git remote add upstream <git repository>

git remote update

git checkout -b <new-branch-name> upstream/master

git cherry-pick <SHA hash of commit>

git push origin <new-branch-name>

Now go to the new branch and you can submit the pull request for the changes.

These commands will help to send a pull request on github.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !