[英]How can I copy commits from one branch to another?
I have 4 commits in my master
branch but I want to copy them and put into a another branch ( branch2
). 我的
master
分支中有4个提交,但我想将它们复制并放入另一个分支( branch2
)中。
Can I do this with cherry pick and if yes how can I? 我可以用樱桃挑选吗?如果可以,我该怎么办?
Yes cherry-pick
is what you want here. 是
cherry-pick
是你想要的这里。 If the commits are consecutive: 如果提交是连续的:
git checkout branch2
git cherry-pick <commit-1-id>..<commit-4-id>
Otherwise you will have to specify them individually: 否则,您将必须分别指定它们:
git cherry-pick <commit-1-id> <commit-2-id> <commit-3-id> <commit-4-id>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.