Git:如何在没有所有先前历史的情况下挑选一个提交

问题描述 投票:0回答:1

我想从current存储库中的特定提交到upstream存储库中添加一些特定的更改。

运行类似这样的内容:git push upstream <commit SHA>:<remotebranchname>

添加提交以及所有以前的更改

运行类似

git checkout -b new-branch 
git pull <remote> <upstream branch> branch is
git cherry-pick <commit hash>
git push <remote> new-branch

也写所有以前的更改。

我只想将该提交的特定更改写入upstream存储库中,因此它不包括我的current存储库中先前提交的更改,而不是upstream中的更改。

[StackOverflow上有很多有关cherry-pickrebase的信息,但没有一个回答这个非常具体的问题。

git git-commit git-rebase git-cherry-pick
1个回答
1
投票

您可以从上游分支创建分支,然后选择樱桃。

假定“上游”是上游遥控器的名称。然后,您可以执行以下操作:

© www.soinside.com 2019 - 2024. All rights reserved.