简体   繁体   English

从另一个分支挑选一些提交

[英]Cherry-Picking few commits from another branch

I have a scenario where I don't want to cherry-pick a specific commit but a range of git commits from remote.我有一个场景,我不想挑选特定的提交,而是从远程选择一系列 git 提交。 I can do force pull with hard option but that will get all the commits including latest changes from remote.我可以使用硬选项强制拉取,但这将获得所有提交,包括来自远程的最新更改。 Please suggest how can I pick range of commits from remote.请建议我如何从远程选择提交范围。


For instance, this is what I am trying:例如,这就是我正在尝试的:

git checkout -b newbranch 62ecb3

git rebase --onto master 76cada, 56qwqw, 46erer

Let's say the history is ABCDEFG , and you'd like to cherry-pick CDEF .假设历史是ABCDEFG ,并且您想挑选CDEF

git cherry-pick B..F

or

git cherry-pick C^..F

or

git cherry-pick C D E F

使用
git cherry-pick 76cada 56qwqw 46erer

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM