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

Merge

Important

Although there’s no merge command, you will still merge two branches.

A couple pages ago I teased a puzzle: you can create lines of commits, but how do you merge them?

Say you want to merge dev with manual, that is z with o, going from:

○  z           Click alternates Xs and Os **dev**
○  v            Click sets a X
○  s            Square has state
│
│ ○  o          Play instructions **manual**
│ ○  kx         Play manual
├─╯
~

to:

@    vz          Here's the merge
├─╮
│ ○  o          Play instructions instructions **dev**
│ ○  kx         Play manual
○ │  z          Click alternates Xs and Os **manual**
○ │  vv         Click sets a X
○ │  s          Square has state
├─╯
~

Your turn. I promise you already know the command.

Warning

What would you type?

Note

Remember, to add a Change on top of X you run:

jj new -r X

The -r X part means:

Hey Jujutsu! Create a new Change, having `X` as its parent.

Note

Most commits have 1 parent.
All merge commits share something special.

Tip

A merge commit is simply a new commit with 2 parents!
To give a new Change 2 parents, pass both using -r. In this case:

jj new -r dev -r manual -m "Here's the merge"

Notice that neither dev nor manual moved.

If you got it, kudos! That wasn’t easy!