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

Goal

You will play with Git and Jujutsu, to convince yourself that Local Bookmarks and Git branches at aligned in realtime.

Local Bookmarks and Branches

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

Try creating a branch in Git:

git branch dev

Notice how a Bookmark was instantly created in Jujutsu.

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

This is also refleted in the output of jj bookmark list:

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

Try moving the Bookmark `main`:

```console
$ jj bookmark move main -t o
Moved 1 bookmarks to ovrsvuxw 7c6a6f6c dev main* | Hola
PS C:\prg\personal\jj\remotes\commit> jj
@  n    (empty)
○  o    dev main Hola
○  k    Hello
◆  z    (empty)

Look at Git:

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

The Git's local branches and the Jujutsu's local Bookmarks are always aligned, to the point that you can think of them as the same thing.

Can They Be Not Aligned?

Technically, it's possible to misalign local Git branches and Jujutsu Bookmarks, but these are degenerate situations: they won't happen in your day-to-day work.

But since you asked, if they happen to be diverge, you'd see a history tree like this:

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

You can interpret this situation as follows:

  • The local Bookmark foo is on y: Jujutsu would like the Git branch to point to Change y. The asterisk after its name is an invitation to do a aligned its correspondant (pseudo)-remote Bookmark.

  • The remote Bookmark foo@git indicates that the known position of the foo branch in the git remote (well, the local Git repository) is x.

The two Bookmarks don't agree, and there is really nothing Jujutsu can do on its own to resolve the situation.

The intuition I suggest you develop is:

Jujutsu's Bookmarks indicate the position that Jujutsu would like the Git branches (and, in general, the remote Bookmarks) to take.

This interpretation will help you tackle the real case of remotes.