Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

git - How to "pull request" a specific commit

I've got a specific commit which I would like to contribute to a repository I have forked on github. I assume the mechanism to do so is a "pull request". However when I try this I can only pull request my whole branch. I do not wish to pull request the other commits as they are not relevant. Any idea how I can do this.

repo I wish to pull request to.

The last commit b50b2e7 is the only commit I wish to pull request. Anyway I can do this or are all commits dependent on each other?

commit I wish to pull request

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

Create a new branch with just that change:

# If you haven't set up your remote yet, run this line:
# git remote add upstream https://github.com/konradjk/exac_browser.git
git fetch --all                                   # Get the latest code
git checkout -b my-single-change upstream/master  # Create new branch based on upstream/master
git cherry-pick b50b2e7                           # Cherry pick the commit you want
git push -u origin my-single-change               # Push your changes to the remote branch

Then create the PR from that branch.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...