我如何将多个分支合并为主? [英] How do I merge multiple branches into master?

查看:408
本文介绍了我如何将多个分支合并为主?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  C --- D => b1 
/
/ E --- F => b2
| /
A - B =======>掌握
| \
\ G --- H => b3
\
I --- J => b4

我想合并 b1 b2 b3 b4 转换为 master ,是否可以一次合并



类似于:

  git checkout master 
git merge b1 b2 b3 b4


解决方案

c> merge 命令支持多个合并策略。有两种策略可以同时合并两个以上的分支。

另见问题,以获得对每个人不太正式的描述。



章鱼




这解决了两个以上
元首的情况,但拒绝执行需要手动解析的复杂合并。
它主要用于将主题分行负责人
捆绑在一起。这是拉动或合并
多于一个分支时的默认合并策略。


最后一条语句暗示如果您执行 git merge branch1 branch2 ... ,它将使用章鱼策略。



我们




这解析了任意数量的头,但合并结果树始终是当前分支头的树,有效地忽略了
所有其他分支的所有更改。这意味着用于
取代旧分支的旧发展历史。


请参阅 question 作为用例示例。


        C---D  =>b1
      /    
     /  E---F  =>b2
     | /   
  A--B =======> master
     | \
     \  G---H  =>b3
      \ 
       I---J   =>b4

I want to merge b1,b2,b3,b4 into master, is it possible merge at once?

something like:

git checkout master
git merge b1 b2 b3 b4

解决方案

Git's merge command supports multiple merging strategies. There are two strategies that can merge more than two branches at a time.

See also this question for a less formal description of each one.

octopus

This resolves cases with more than two heads, but refuses to do a complex merge that needs manual resolution. It is primarily meant to be used for bundling topic branch heads together. This is the default merge strategy when pulling or merging more than one branch.

The last statement implies that if you do git merge branch1 branch2 ..., it'll use the octopus strategy.

ours

This resolves any number of heads, but the resulting tree of the merge is always that of the current branch head, effectively ignoring all changes from all other branches. It is meant to be used to supersede old development history of side branches.

See this question for a use case example.

这篇关于我如何将多个分支合并为主?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆