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

Local Bookmarks and Branches

Important

You see how Local Bookmarks and Git branches stay aligned in real-time.

@  n    (empty)
○  o    Hola
○  k    main Hello
◆  z    (empty)

Create a Git branch:

git branch dev

Notice how Jujutsu instantly reflects this as a new Bookmark dev:

@  n    (empty)
○  o    Hola **dev**
○  k    Hello **main**
◆  z    (empty)

This is also reflected in jj bookmark list:

jj b l
**foo**: nwupqqun 9cad0562 (empty) (no description set)
**main**: kxrxykwo 709deefc Hello

Now, move the main Bookmark:

jj bookmark move main -t o
Moved 1 bookmarks to ovrsvuxw 7c6a6f6c dev main* | Hola

@  n    (empty)
○  o    Hola **dev** **main**
○  k    Hello
◆  z    (empty)

Check Git:

git log --oneline --graph
* 7c6a6f6 (**HEAD**, **main**, **dev**) Hola
* 709deef Hello

See? Local Git branches and local Jujutsu Bookmarks are always aligned; you can safely consider them identical.

Can They Diverge?

Technically, yes, but only in degenerate situations, outside day-to-day work. Here’s what you would see:

@  x   **foo@git**
│ ○  y   **foo***
├─╯
○  q
◆  z    (empty)

You can interpret this as:

  • Local Bookmark foo is on y. Jujutsu would like to set the Git branch here too. The asterisk * invites you to align them.
  • The remote Bookmark foo@git indicates that the last known position of foo in the git pseudo-remote is x.

Usually, Jujutsu aligns this situation autonomously.

The intuition I suggest you to develop is:

Jujutsu’s Bookmarks indicate the position Jujutsu wants the Git branches and the remote branches to take.

By the way: that’s a good chance to talk about remotes.