How do I create a criss-cross merge in Git?

微笑、不失礼 提交于 2019-12-13 07:35:03

问题


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.


回答1:


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

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

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.

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




回答2:


You're talking about this scenario: http://www.gelato.unsw.edu.au/archives/git/0504/2279.html

I also tried to reproduce what happens there, but git doesn't fail with an error, I think it switches to resolve strategy which maximizes conflicts, at least that's what git(vers 1.8.3.rc1) gave me to solve when I reproduced it.



来源:https://stackoverflow.com/questions/17220846/how-do-i-create-a-criss-cross-merge-in-git

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!