2 Comments
User's avatar
Ilya's avatar
Mar 29Edited

3-way merge has its share of problems but, on the flip side, one situation where 3-way merge really shines is if you have

```

A->B->C

```

and then decide that B was a mistake. Then, you want to rebase C onto B. For the 3-way merge, this is no problem. You end up with a 3-way merge with sides `A` and `C`, and base `B` (the 3-way merge representation of applying the diff `B->C` on top of `A`; I usually think of that in `jj` terms, <https://docs.jj-vcs.dev/latest/technical/conflicts/>).

After reading the README, I wonder whether and how a weave can handle this. The rebase example in the README, at least, didn't immediately seem to apply to this use-case.

I think Darcs/Pijul also have trouble with this use-case (I believe Darcs essentially ended up introducing https://darcs.net/Using/Rebase for this which, I believe, is a 3-way merge, though my memory is dated). I am not sure whether or not a version control system can be convenient without supporting it. Have you thought about it?

(Though, to be fair, I don't know how much this limited darcs; its major limitation is/was considered to be the performance and the "exponential merge problem" and not this kind of rebase IIUC)

One way to address this is if you could easily have inverses, i.e. starting with `A -> B` there was a natural state `A'` you could create with `A -> B -> A'` and A' and A being in some way equivalent. Then, you could rebase C onto A'. I'm not sure whether or not weaves naturally support this.

Of course, worst-case, doing a 3-way merge in this case and forgetting the history of it (just recording the result in the weave as an addition) is an option.

Bram Cohen's avatar

The readme in the manyana github page goes into that at length. It’s deeply problematic in a truly distributed system because of the criss-cross case. If you want a decent ‘local undo’, you make a local undo, then make a branch and make a re-do in that branch, then cherry pick that redo in main and make main win any merge conflicts.