Skip to content

Instantly share code, notes, and snippets.

@greggman
Last active October 12, 2025 23:29
Show Gist options
  • Save greggman/1b6dc4fac85e99020bcb667778724b5f to your computer and use it in GitHub Desktop.
Save greggman/1b6dc4fac85e99020bcb667778724b5f to your computer and use it in GitHub Desktop.
jj notes

jj notes

Assume you have commits A B C D E where E is the newest commit

show jj commits (not the same as git commits)

jj log

note: jj commit names are on the left, git on the right (usually unimportant)

move a few lines from B to C (and rebase D E)

jj squash -i --into B --from C

NOTE! the -i is important, otherwise it will put all of B in C. Though you can undo with jj undo

edit B and then rebase C D E

jj edit B
# do edits
jj edit E      # automatically rebases

rebase C D E on git origin/main

jj git fetch --remote origin --branch main  # pulls git origin/main into .git data
jj rebase -s C -d main@origin               # -s means --source, -d means --destination so "rebase src on dst"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment