Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

History of a Change

Goal

  • You learn how to inspect the past of a Change.

Every Change has its History.

Do this little exercise. Target any Change you like, such as n:

$ jj log

@  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
○    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

Make some modifications to it, like:

  • Update its description
    • jj desc -r n -m foo
    • jj desc -r n -m bar
    • jj desc -r n -m baz
  • Check it out and edit some files:
    • jj edit -r n
  • Add a Change before it:
    • jj new -B n

Under the hood, each of those operations creates a new Git commit. Each time, Jujutsu makes sure the immutable Change ID n points to whichever commit is the most recent one. Throughout its existence, n goes through different states, each a different Git commit. n was born as commit 27ea11. Then it evolved to a different commit, then another, and so on. In a sense, n has its own history tree.

This isn't merely a metaphor. You can actually display that history with evolog:

jj evolog -r n

  ○  nvokxlrr arialdo@ik.me 2026-06-12 22:52:51 c655c8d7
  │  baz
  │  -- operation 2e1a28a42c55 abandon commit 668d65f4f0eea395a4c3d0a7ed890254a60865d4
  ○  nvokxlrr/1 arialdo@ik.me 2026-06-12 22:52:45 6e2c1c9a (hidden)
  │  baz
  │  -- operation 500080ebf19a new empty commit
  ○  nvokxlrr/2 arialdo@ik.me 2026-06-12 22:52:39 983a1599 (hidden)
  │  baz
  │  -- operation 3075743719f1 describe commit 22c5df185272af6f25b1d4227cd271971aa1baa5
  ○  nvokxlrr/3 arialdo@ik.me 2026-06-12 22:52:37 22c5df18 (hidden)
  │  bar
  │  -- operation 3daa0e64a476 describe commit 21a546e29d1cfcebdc0aafd8023c3d60416bff88
  ○  nvokxlrr/4 arialdo@ik.me 2026-06-12 22:52:34 21a546e2 (hidden)
  │  foo
  │  -- operation 4c7fc048be20 describe commit a857703785c7971ec20ccd826e36557f8b7d5a72
  ○  nvokxlrr/5 arialdo@ik.me 2026-06-12 22:52:28 a8577037 (hidden)
  │  Foo
  │  -- operation a6df8a6d9206 describe commit 03e16e725052f4ba32bb0a1a31a029860a86519a
  ○  nvokxlrr/6 arialdo@ik.me 2026-06-10 14:33:07 03e16e72 (hidden)
     Square is interactive

Consider this the meta-repository that tracks the history of n. Its commits are called n/1, n/2 etc. There's nothing special about these commits: you use them in commands just like any other. Meaning: you don't need to learn new special commands, like with Git reflog.

Want to inspect the changes stored in n/5?

Solution

Just run jj show n/5.

Nailed it? You rock!

In many cases, you'll use this meta-history to recover files you want to restore.