如何在Git中创建纵横交错的合并? [英] How do I create a criss-cross merge in Git?

查看:86
本文介绍了如何在Git中创建纵横交错的合并?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须测试一个错误修复程序,并且需要在两个分支之间创建纵横交错的合并.没有太多的文档,对Git来说我还很陌生.我没有提交代码,只是测试我们的代码审查系统的功能.

I have to test a bug fix and I need to create a criss-cross merge between two branches. There isn't much documentation and I am fairly new to Git. I'm not submitting code, just testing the functionality of our code review system.

我用来进行更改的单个文件是一个简单的自述"文本文件.

The single file I am using to make changes is a simple Read me text file.

推荐答案

当历史涉及纵横交错的合并时,对于两次提交,可以有一个以上的最佳共同祖先.例如,使用以下拓扑:

When the history involves criss-cross merges, there can be more than one best common ancestor for two commits. For example, with this topology:

---1---o---A
    \ /
     X
    / \
---2---o---o---B


以上内容来自 git网站,我想它忘记了添加箭头.


The above comes from the git website, I guess it forgets about adding an arrow.

让我们看一下下面的图片,很明显,那么如何做出纵横交错的情况.当分支A需要分支B的一些代码时,它会从分支B合并;当分支机构B需要分支机构A的某些代码时,它会合并分支机构A的代码;在这里,我们遇到了纵横交错的情况.

Let's look at the pic below, it is obvious how to make a criss-cross situation then. when branch A needs some code from branch B, it merges from branch B; when branch B needs some code from branch A, it mergers from branch A; here we come across the criss-cross situations then.

更重要的是,很容易发现分支机构A和分支机构B共享祖先1和2.

Even more, It is easy to figure out that branch A and branch B share ancestors 1 and 2.

这篇关于如何在Git中创建纵横交错的合并?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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