Merge
Important
Although there’s no
mergecommand, 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
Xyou run:jj new -r XThe
-r Xpart 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!