gpt4 book ai didi

git - 在 GitHub 上发送 pull 请求,仅获取最新提交

转载 作者:IT王子 更新时间:2023-10-29 01:13:11 25 4
gpt4 key购买 nike

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

我想知道我是否应该创建一个新的本地分支,检查它并以某种方式重置或 rebase 到上游?然后通过 id 将我的主人的最后一次提交应用到新的本地分支并将其用于 pull 请求?

我正在尝试正确理解概念并找出正确的命令行来执行我需要的操作。

最佳答案

您基本上需要创建一个新分支 & cherry-pick 您要添加到其中的提交。

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

git remote add upstream <git repository>

git remote update

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

git cherry-pick <SHA hash of commit>

git push origin <new-branch-name>

之后,您将看到 <new-branch-name> github 上的分支,切换到它并可以提交包含您想要的更改的 pull 请求。

关于git - 在 GitHub 上发送 pull 请求,仅获取最新提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5256021/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com