简体   繁体   English

Git Move提交到分支

[英]Git move commits to a branch

Here's the commit graph I have: 这是我的提交图:

A--B--C--D--E--F (master)

And here's what I want: 这就是我想要的:

A--B--E--F (master)
    \
     C--D (branch1)

from master I can create branch1 , then rebase interactively from B both master and branch1 , picking the commits I want, but I think it not straghtforward. master我可以创建branch1 ,然后从masterbranch1 B进行交互变基,选择我想要的提交,但是我认为这不是很简单。 Is there a better way to do that? 有更好的方法吗?

No, rebasing is the most straigtforward way to do this. 不,变基是执行此操作的最快捷的方法。 The only other way is a more manual way with git cherry-pick and git reset. 唯一的其他方法是使用git cherry-pick和git reset的更手动的方法。

git branch branch1 master
git rebase --onto B D master

Hope this helps 希望这可以帮助

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

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