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

In which you learn that Bookmarks are like branches, but they may point to multiple commits.

Bookmarks are Not Branches

Let's dive right into the oddities. Jujutsu has gotten you used to them by now, right?

  • In Git a branch is a label, a name pointing to 1 and only 1 commit. There are local branches and remote branches. A simple model, after all1.
  • In Jujutsu, Bookmarks are labels that, in general, point to multiple revisions.

That should not sound that weird. After all, it's consistent with what you've already seen.
Remember how Jujutsu handles conflicts? All Changes, we saw, have a collection of Trees:

  • Some have only 1 Tree, so they're conflict-free.
  • Some point to multiple ones, so they have conflicts to resolve.

The same logic applies to Bookmarks. Think of Bookmarks as labels that point to one or more revisions. Normally, a Bookmark points to a single revision:

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

In this happy case the Git and Jujutsu models are extraordinarily similar. Jujutsu will display a history tree like:

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

When a Bookmark points to multiple revisions:

@  x  <--------- foo
│                /
│ ○  y <--------'
├─╯
○  q
◆  z

then there's a conflict and you'll need to resolve it, finding a way to make the Bookmark point to 1 revision only. Jujutsu will show you a log like this:

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

In the next few pages you'll see how to resolve these cases. Spoiler: conflicts happen when both you and some colleague of yours on a remote have moved the same branch to two irreconcilable positions.

The good news is: the logic for resolving code conflicts is similar to those for resolving bookmark concflits. Even easier, in fact.


  1. If it weren't for the name "branch" itself, which always confuses newcomers. In Git a branch is both a pointer to a commit and a sequence of commits that diverges from the trunk.