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

Wrong Order

Sometimes conflicts are not about Changes content, but in the order they end up in.

Use Case

○  h
○  g
│ ○  f  <- removes file README.md
│ ○  e  <- modifies file README.md
│ ○  d
│ ○  c
├─╯
○  b
○  a
◆
  • Rebase f on top of h:
jj rebase -r f -o h
○  f  <- removes file README.md
○  h
○  g
│ ○  e  <- modifies file README.md
│ ○  d
│ ○  c
├─╯
○  b
○  a
◆
  • Rebase e on top of f:
jj rebase -r e -o f
×  e  <- modifies file README.md
○  f  <- removes file README.md
○  h
○  g
│ ○  d
│ ○  c
├─╯
○  b
○  a
◆
  • Conflict.

Solution

The 2 rebases swapped e and f from their original order. An easy solution is to swap them back:

jj rebase -r e --before f
○  f  <- removes file README.md
○  e  <- modifies file README.md
○  h
○  g
│ ○  d
│ ○  c
├─╯
○  b
○  a
◆

And the conflict is gone.