Unmerge
How to unmerge?
@ vz empty Here's the merge
├─╮
│ ○ o Play instructions
│ ○ kx Play manual
○ │ zx Click alternates Xs and Os main
○ │ vv Click sets a X
○ │ s Square has state
├─╯
○ n Square is interactive
~
That's an easy one! If merging was the last operation, just jj undo:
$ jj undo
@ p empty
○ zx Click alternates Xs and Os main
○ v Click sets a X
○ s Square has state
│ ○ o Play instructions
│ ○ kx Play manual
├─╯
○ n Square is interactive
~
Unmerging with abandon
Otherwise, you could jj abandon the merge Change. Give it a try.
Let's start over:
$ jj redo
Yes! You can redo an undo. Jujutsu's undo works like Emacs': rather
than just going back in time, it appends the revert to an
operation log, so no information is ever lost. If you are curious,
read about it in Emacs' Undo.
You are back to:
@ vz empty Here's the merge
├─╮
│ ○ o Play instructions
│ ○ kx Play manual
○ │ zx Click alternates Xs and Os main
○ │ vv Click sets a X
○ │ s Square has state
├─╯
○ n Square is interactive
~
Now, do yourself a favour: move somewhere else before deleting the merge, or you'll be abandoning your Current Change1:
$ jj edit n
○ vz empty Here's the merge
├─╮
│ ○ o Play instructions
│ ○ kx Play manual
○ │ zx Click alternates Xs and Os main
○ │ vv Click sets a X
○ │ s Square has state
├─╯
@ n Square is interactive
~
Now your turn.
- Unmerge, without using
undo. - Then create a new merge, this time between 3 commits:
zx,oandn.
Solution
Solution
Elementary, my dear Watson!
$ jj abandon vz
○ zx Click alternates Xs and Os main
○ v Click sets a X
○ s Square has state
│ ○ o Play instructions
│ ○ kx Play manual
├─╯
@ n Square is interactive
~
Then:
$ jj new -r zx o n
@ u empty
├─┬─╮
│ ○ │ o Play instructions
│ ○ │ kx Play manual
│ ├─╯
○ │ zx Click alternates Xs and Os main
○ │ v Click sets a X
○ │ s Square has state
├─╯
○ n Square is interactive
○ ru Board() invokes Square()
├─╮
○ │ ym fix name: Square -> Board
○ │ x WIP delete me
○ │ yz LICENSE
○ │ ws A board full of X
├─╯
○ kk Displays X X
○ wx Fails
○ rx Scaffold applicatio
◆ zz 🔒 empty
Was it too easy? See? You already think like a jujutsuka!
In Git, undoing a merge ranges from easy to painful, depending on your experience. I hope you see how Jujutsu makes it trivial regardless.
-
Abandoning the Current Change is perfectly legit, but the first time the behavior might surprise you. If you are curious, read more about this in Pulling the Rug Out Under Oneself ↩