Skip to content
Go back

Learn JJ

Updated:
Edit page

jj-cheat-sheet.pdf


Rebase1

That’s a little rough. There are some helpful diagrams in jj rebase --help that got me to understand the differences between -r, -s, and -b, but the short of it is that -r will sort of “rip out” a change and move it somewhere else. -s does that, but also moves descendants. In other words, imagine that we have a history like this:

A - B - C - D

If we jj rebase -r C to somewhere else, it will only move that revision, and so you end up with

A - B - D

Whereas -s operates more like I’d be used to with git: it takes the children too, so after jj rebase -s C, you’d have:

A - B

as both C and D are somewhere else now. -b works to rebase a branch.

$ jj rebase -s 'all:roots(trunk..@)' -d trunk

We’re rebasing all of the root changes from trunk to @ onto trunk.

Footnotes

  1. https://steveklabnik.github.io/jujutsu-tutorial/advanced/simultaneous-edits.html#:~:text=That%27s%20a%20little,history%20like%20this%3A


Edit page
Share this post on:

Previous Post
Rust 记录一下 debug
Next Post
安迪·威尔-挽救计划