git - 如何 "pull request"一个特定的提交

标签 git github

我有一个特定的提交,我想将其贡献到我在 github 上 fork 的存储库。 我假设这样做的机制是“pull 请求”。 但是,当我尝试这个时,我只能请求我的整个分支。 我不希望请求其他提交,因为它们不相关。 知道我该怎么做。

repo I wish to pull request to.

最后一次提交 b50b2e7 是我希望 pull 请求的唯一提交。 无论如何,我可以做到这一点,还是所有提交都相互依赖?

commit I wish to pull request

最佳答案

仅使用该更改创建一个新分支:

# 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。

关于git - 如何 "pull request"一个特定的提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34027850/

相关文章:

mysql - 解决 Homebrew 警告而不造成不良影响

git - 如何 merge 位于不同本地存储库/文件夹中的两个 git 分支?

基于特性分支的 Git Workflow

git - 将本地 repo 的所有分支重置为与远程相同

git - 如何在不覆盖数据库数据的情况下进行 git pull

git - 在比较它们之间的差异后,如何使用旧的 git 标签更新当前的主分支?

git - 如何删除所有超过一年的 Git 远程分支?

git - flake8,仅在 diff 和 exclude 上

git - 如何保护github中的 "master"?

git - Intellij 15 + Github - 无法克隆存储库,出现 "Repository Test has Failed"错误