将git分支分成两个分支?

编程入门 行业动态 更新时间:2024-10-22 04:51:51
本文介绍了将git分支分成两个分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图帮助一位同事从另一个功能分支意外创建了一个功能分支,而不是从主分支创建第二个功能分支。这里基本上是我们现在所拥有的......

大师--- A --- B --- C \\ \\ Foo E --- F --- F --- H \ Bar J --- K --- L --- M

这就是我们想要的...

大师--- A --- B --- C | \ Foo | E --- F --- F --- H | Bar J --- K --- L --- M

想到的是创建FooV2和BarV2分支,然后樱桃挑选单个提交到适当的V2分支。但我很好奇,是否有更好的方法来处理这种情况?

解决方案

它看起来像我可以:

git checkout J git rebase master

编辑:

我尝试了我的建议,但不起作用。 knittl的建议不起作用(在我的盒子里)。这是什么为我工作:

git rebase --onto master foo bar

I'm trying to help out a coworker who accidentally created one feature branch from another feature branch, rather than creating the second one from master. Here is essentially what we have now…

Master ---A---B---C \ Foo E---F---F---H \ Bar J---K---L---M

And here is what we'd like to have…

Master ---A---B---C |\ Foo | E---F---F---H | Bar J---K---L---M

One way I thought of would be to create FooV2 and BarV2 branches, and cherry-pick the individual commits into the appropriate V2 branches. But I'm curious, is there a better way to handle this situation?

解决方案

It looks to me like you could:

git checkout J git rebase master

Edit:

I tried what I suggested and it doesn't work. knittl's suggestion doesn't work (on my box). Here's what did work for me:

git rebase --onto master foo bar

更多推荐

将git分支分成两个分支?

本文发布于:2023-11-26 00:38:00,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:分支   两个   git

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!