Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Back to Grade School!

Imagine this (admittedly contrived) situation:

○  S    s/hola/salut/g  -> salut world     S  = H + (S − H)
○  H    s/hello/hola/g  -> hola world      H  = B + (H − B)
○  B                       hello world

Revert H with jj revert H. This applies - (H - B) = (B - H) to S:

×  P'   s/hola/hello/g                   P' = S + (B - H)
○  S    s/hola/salut/g  -> salut world   S  = H + (S − H)
○  H    s/hello/hola/g  -> hola world    H  = B + (H − B)
○  B                       hello world

The natural basis for (B - H) would be H, but it landed on S. Wrong base: conflict.

Resolve it by rebasing P' back to H:

jj rebase -r P' -d H
○  P'   s/hola/hello/g    -> hello world   P' = H + (B − H) = B
│ ○  S  s/hola/salut/g    -> salut world   S  = H + (S − H)
├─╯
○  H    s/hello/hola/g    -> hola world    H  = B + (H − B)
○  B                         hello world

H + (B − H) algebraically simplifies to B.

Conflict gone. No file edits needed. Magic!

Resolving by Abandoning

Alternatively, just jj abandon S:

jj abandon S
○  P'   s/hola/hello/g    -> hello world   P' = H + (B − H) = B
○  H    s/hello/hola/g    -> hola world    H  = B + (H − B)
○  B                         hello world

Same cancellation.

A conflict is really just a diff parked on the wrong base. Moving it where algebra simplifies it makes the conflict vanish.