如何“拉取请求"一个特定的提交 [英] How to "pull request" a specific commit
问题描述
我有一个特定的提交,我想为我在 github 上分叉的存储库做出贡献.我假设这样做的机制是拉取请求".但是,当我尝试这个时,我只能请求我的整个分支.我不想拉请求其他提交,因为它们不相关.知道我该怎么做.
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.
最后一次提交 b50b2e7 是我希望拉取请求的唯一提交.无论如何,我可以这样做还是所有提交都相互依赖?
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?
推荐答案
使用该更改创建一个新分支:
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
然后从该分支创建 PR.
Then create the PR from that branch.
这篇关于如何“拉取请求"一个特定的提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!