在 GitHub 上发送拉取请求以获取最新提交 [英] Send a pull request on GitHub for only latest commit

查看:40
本文介绍了在 GitHub 上发送拉取请求以获取最新提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 github 上 fork 了一个项目,并且成功地对我的本地 master 进行了更改并推送到 github 上的 origin.我想发送拉取请求,但只想包含最后一次提交.github.com 上的 pull request UI 显示了最近的 9 次提交,我不知道如何过滤.

I forked a project on github and am successfully making changes to my local master and pushing to origin on github. I want to send a pull request, but only want to include the last commit. The pull request UI on github.com shows the last 9 commits and I don't know how to filter that down.

我试图了解我是否应该创建一个新的本地分支,检查它并以某种方式重置或重新设置到上游?然后将我的 master 通过 id 的最后一次提交应用到新的本地分支并将其用于拉取请求?

I was trying to understand if I should create a new local branch, check that out and somehow reset or rebase to upstream? Then apply my last commit from my master by id to the new local branch and use that for the pull request?

我正在努力使概念正确并找出正确的命令行来做我需要的事情.

I'm trying to get the concepts right and figure out the right command lines to do what I need.

推荐答案

你需要基本上创建一个新的分支 &樱桃-选择你想添加的提交.

You need to basically create a new branch & cherry-pick the commits you want to add to it.

注意:在 checkout/cherry-pick 命令之前你可能需要这些

Note: you might need these before the checkout/cherry-pick commands

git remote add upstream

git 远程更新

git checkout -b <new-branch-name> upstream/master

git cherry-pick <SHA hash of commit>

git push origin <new-branch-name>

之后,您将在 github 上看到 分支,切换到它并可以提交带有您想要的更改的拉取请求.

Afterwards, you will see <new-branch-name> branch on github, switch to it and can submit the pull request with the changes you want.

这篇关于在 GitHub 上发送拉取请求以获取最新提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆