git 从另一个分支挑选一些提交
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46109211/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cherry-Picking few commits from another branch
提问by Varun Maggo
I have a scenario where in i dont want to cherry pick a specific commit but a range of git commits from remote. 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 get a pick range of commits from remote.
我有一个场景,我不想选择一个特定的提交,而是从远程选择一系列 git 提交。我可以使用硬选项强制拉取,但这将获得所有提交,包括来自远程的最新更改。请提出建议,我如何从远程获取选择范围的提交。
For instance, this is what i am trying my head at.
例如,这就是我正在尝试的。
git checkout -b newbranch 62ecb3
git checkout -b newbranch 62ecb3
git rebase --onto master 76cada, 56qwqw, 46erer, etc
git rebase --onto master 76cada、56qwqw、46erer 等
采纳答案by Dane
Usegit cherry-pick 76cada 56qwqw 46erer
用git cherry-pick 76cada 56qwqw 46erer
回答by ElpieKay
Let's say the history is A-B-C-D-E-F-G
, and you'd like to cherry-pick C-D-E-F
.
假设历史是A-B-C-D-E-F-G
,并且您想挑选C-D-E-F
。
git cherry-pick B..F
or
或者
git cherry-pick C^..F
or
或者
git cherry-pick C D E F