0

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.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
  • Can you be more specific as to what you mean by "criss-cross merge". Perhaps an example would help. For teasing out bugs between commits, I find `git-bisect` can be quite helpful – rynmrtn Jun 20 '13 at 18:26
  • If by a criss cross merge, you mean merging one branch into another, then it is pretty easy: git checkout branch1, git merge --no-ff branch2 – David K Jun 20 '13 at 23:26
  • 1
    I wrote a minimal working exemple for creating a criss-cross merge in [this answer](https://stackoverflow.com/questions/26370185/how-do-criss-cross-merges-arise-in-git/26371211#26371211). – jub0bs Nov 06 '18 at 16:30

2 Answers2

2

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.

enter image description here

briefy
  • 211
  • 3
  • 6
0

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.

mihaicc
  • 3,034
  • 1
  • 24
  • 20