Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
758 views
in Technique[技术] by (71.8m points)

github - Git - Cherry pick a single commit for pull request

I might not have the terminology down yet. I made file to be added to a open project on git. I forked the project. I made some changes and my last commit is the file I want to request to the project and not the small changes I made before hand. When I go to github site and make pull request I get all the commits before the one I want which is last one of a file and I don't' want to submit all of the other commits because I don't think its necessary for the project. Just my own changes. What do I do? Should I just make another res or attach the file singularly and submit, if that's possible.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need to create a fresh branch from the remote HEAD, cherry-pick the commit to that branch, push the branch to your repo on GitHub, then create a pull request.

git checkout -b mybranch
git fetch upstream
git reset --hard upstream/master
git cherry-pick <commit-hash>
git push origin mybranch:mybranch

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...