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

Goal

  • You start learning how to resolve conflicts by editing files.
  • You learn that conflict resolution propagates to descendants.
  • Then you see some cases where you can resolve a rebase conflict by other means, like by doing another rebase or by abandoning Changes.
  • Finally, if you are curious, you read how Jujutsu handles conflicts, internally, and you get what it means that they are first-class citizens.

Conflicts

We will spend quite a bit of time on this topic. Not because it's tricky, but because it's one of the scariest topics in Git, and I'm determined to put that fear to rest once and for all.

We will play with conflicts in practice, with a real repository. Clone it with:

jj git clone https://codeberg.org/arialdo/jj-playground-conflicts.git

Then, as before, create a tracked local branch for each remote branch:

jj bookmark track '*' --remote origin

You haven't seen the first command before: it creates a local bookmark for each remote branch. We'll see bookmarks in a few pages.

Here's the history tree:

@  mv   hello mundo
│ ○  nz hola world
├─╯
○  vr   hello world
○  ypl
○  vw
│ ○  nl
│ ○  ypy
│ ○  mw
│ ○  ww
│ ○  wq
├─╯
○  x
○  vn
○  r
│ ○  no  feat-1
│ ○  vt
│ ○  s
│ ○  u
│ ○  vz
├─╯
○  q
◆  z

Ready to go! We will do the following moves, each producing some conflicts, progressively more challenging (but I swear: they are all trivial):

  1. We merge mv and nz to get a merge conflict.
  2. Then we rebase the branch feat-1 to get 1 single rebase conflict.
  3. Then the branch feat-2, to get multiple conflicts.

Then, we will play with some novel conflict resolution techniques that are just not available with Git.

Ready? Hands on the keyboard!