Rebasing a Branch
Important
You rebase a branch, then you move it back.
Rebasing sparse Changes is rarely that useful. More often you’ll
rebase whole branches. Revset helps here too.
If you ran jj undo previously, your tree should look like this:
@ m ▢
○ qn Add the CSS file **css***
○ rt Link to CSS
│ ○ o Play instructions **manual*** <-- move it here
│ ○ kx Play manual
├─╯
│ ○ zx Click alternates Xs and Os **dev*** ⎫
│ ○ v Click sets a X ⎬ this branch
│ ○ s Square has state ⎭
├─╯
○ qq Fix
~
Warning
How would you rebase the branch from
stozxon top ofo?
Tip
The solution is the literal translation of the request:
jj rebase -r "s::zx" -o o
You should arrive at:
○ zx Click alternates Xs and Os main
○ v Click sets an X
○ s Square has state
○ o Play instructions
○ kx Play manual
│ ○ qn Add the CSS file css
│ ○ rt Link to CSS
├─╯
○ qq Fix
~
Alternatively, you can use --source / -s to mark the cut point for
the branch you want to rebase:
jj rebase -s s -o o
Warning
How would you undo that using
rebaseinstead ofundo?
Tip
The original base of
s::zxwasjj rebase -r "s::zx" -o qq
Give yourself a pat on the back if you nailed it.