简体   繁体   中英

Pull a specific commit and add that to a branch to update a PR

I send a PR from origin Project/myBranch to an upstream Project/master and what I want to do is pull a specific commit with its SHA and add that commit to the myBranch branch and update that PR. So how should I do it? I have been struggling to do this for over an hour but still no success.

You could cherry-pick the commit into your branch and push the branch to Github again (the PR will be automatically updated when you push the branch again).

From your local clone of Project, assuming the upstream Project is origin :

git fetch origin
git checkout myBranch 
git cherry-pick <SHA of the specific commit>
git push origin myBranch

You need to fetch from origin if you not already have fetched the specific commit.

Other changes that you may have been committed to your branch will also be pushed and included in the PR.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM