简体   繁体   English

我如何使用TortoiseGit在未提交的情况下Cherry选择其他分支的提交?

[英]How can i Cherry pick a commit of another branch using TortoiseGit without committing?

I can cherry pick a commit using bash 我可以使用bash挑选提交

git cherry-pick -n <HASH>

But is there any way to do that by using TortoiseGit? 但是,有什么办法可以使用TortoiseGit吗?

Checkout the branch on which you want to cherry pick the commit it. 签出要在其上进行选择的分支。 Then 然后

  • open the Log Dialog, 打开日志对话框,
  • scroll to the commit (maybe you have to select "all branches" in the lower left or use the top-left blue branch name to select the source branch and filter the list for the commit hash), 滚动到提交(也许您必须在左下方选择“所有分支”,或使用左上角的蓝色分支名称选择源分支并过滤提交哈希的列表),
  • open the context menu on the commit and 在提交中打开上下文菜单,然后
  • select "Cherry pick this commit...". 选择“樱桃选择此提交...”。

Now you basically have two options as the -n option is not directly available in TortoiseGit. 现在,您基本上有了两个选项,因为-n选项在TortoiseGit中不直接可用。

1) Change the cherry-pick type from "Pick" to "Edit", start the cherry-pick and then, check the "Edit commit" checkbox, keep the commit dialog open, do your changes and then commit and finish the cherry-pick. 1)将cherry-pick类型从“ Pick”更改为“ Edit”,启动cherry-pick,然后选中“ Edit commit”复选框,保持commit对话框打开,进行更改,然后提交并完成cherry-挑。

2) Finish the cherry pick and then 2)完成樱桃摘,然后

  • go to your HEAD commit, 去你的HEAD提交,
  • select the parent commit of the just cherry picket commit, 选择Just Cherry Picket提交的父提交,
  • and choose "Reset" on the context menu and 然后在上下文菜单中选择“重置”,然后
  • select mixed. 选择混合。

cf. cf. https://tortoisegit.org/docs/tortoisegit/tgit-dug-cherrypick.html https://tortoisegit.org/docs/tortoisegit/tgit-dug-cherrypick.html

Suppose you want to cherry-pick Commit X from dev to master . 假设您想将Commit X从dev挑选到master

  1. Right click in the repository and select TortoiseGit -> Switch/Checkout -> select master and press OK. 右键单击存储库,然后选择TortoiseGit->切换/签出->选择master ,然后按OK。
  2. Right click in the repository and select TortoiseGit -> Browse references -> Right click on dev -> Show log. 右键单击存储库,然后选择TortoiseGit->浏览参考->右键单击dev >显示日志。
  3. Right click on the commit you want to cherryp-pick and select Cherry Pick this commit -> Continue. 右键单击要进行选择的提交,然后选择Cherry选择此提交->继续。
  4. Since the cherry-pick menu doesn't support the option -n , we can do a mixed reset back to the previous commit to simulate -n . 由于cherry-pick菜单不支持选项-n ,我们可以将混合重置返回到先前的提交,以模拟-n TortoiseGit -> Browse references -> Right click on master -> Show log -> Right click on the previous commit -> Reset "master" to this... -> Press OK. TortoiseGit->浏览参考->右键单击master >显示日志->右键单击上一个提交->将“ master”重置为此...->按OK。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我怎么能 git cherry-pick 从分支 A 到分支 B 但我在分支主机中的提交? - how can I git cherry-pick a commit from branch A to branch B but I am in branch master? Cherry挑选使用TortoiseGit - Cherry pick using TortoiseGit 如何使用指向提交的 http 链接将 gerrit 提交/补丁提取/樱桃选择到分支? - How do I pull/cherry-pick a gerrit commit/patch to a branch using a http link to the commit? 如何合并来自另一个分支的单个提交而没有副作用(又称不使用Cherry-pick)? - How to merge individual commits from another branch without side effects (aka without using cherry-pick)? 如何使用cherry-pick或任何其他方法将提交(包含2-3个文件)从一个分支移动到另一个分支 - How to Move commit(contains 2-3 files) from one branch to another branch using cherry-pick or any other method 我可以合并过去的提交中的将来分支,而不合并它们之间的共享提交,也可以不进行选择吗? - Can I merge a branch from the future at a commit in the past without merging the shared commits between them, or without cherry-pick? TortoiseGit樱桃挑选失败! 跳过此提交? - TortoiseGit cherry pick failed! Skip this commit? 如何从一个分支樱桃采摘到另一个 - How to cherry pick from 1 branch to another 我如何挑选到以前的提交? - How do I cherry pick into a previous commit? 无法选择一个提交到分支(错误对象错误) - Can't cherry pick one commit to a branch (bad object error)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM