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

Bookmarks are Not Branches

Important

You learn that Bookmarks can point to multiple commits simultaneously.

Let’s dive into the oddities. You’re used to them by now.

  • In Git, a branch is a label pointing to exactly 1 commit. A simple model1.
  • In Jujutsu, Bookmarks are labels that can point to multiple revisions.

This shouldn’t sound too weird; it’s consistent with what you know about conflicts:

  • Changes pointing to 1 Tree are conflict-free.
  • Changes pointing to multiple Trees have conflicts.

The same logic applies to Bookmarks. Normally, a Bookmark points to a single revision:

@  x   ◀─────── **foo**
│ ○  y
├─╯
○  q
◆  z

In this happy case, Git and Jujutsu are identical. You’ll see a log like this:

@  x  **foo**
│ ○  y
├─╯
○  q
◆  z

It may happen that you and a remote colleague move the same branch to irreconcilable positions. In that case, the Bookmark points to multiple revisions:

@  x   ◀────────┐
│               ├─ **foo**
│ ○  y   ◀──────┘
├─╯
○  q
◆  z

You have a Bookmark conflict. You must resolve it so the Bookmark points to just 1 revision. Jujutsu displays this as:

@  x  **foo??**
│ ○  y  **foo??**
├─╯
○  q
◆  z

The good news: the logic for resolving code conflicts applies here, and it’s even easier.


  1. If it weren’t for the confusing name “branch”. In Git, a branch is both a reference to a commit and a sequence of commits diverging from the trunk.