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 learn how to reveal the hidden Changes of remote branches and how to make them mutable.

Tracking Remote Bookmarks

This bears the question: how to tell Jujutsu that you want to work on foo, so:

  • It stops hiding its Changes.
  • It stops treating them as immutable?
$ jj bookmark list --all-remotes
bar@origin: ossuomlo fa22ec04 (no description set)
foo@origin: stnkrwop 00687915 (no description set)
main: urvnvxtx 7dac65ac (no description set)
  @git: urvnvxtx 7dac65ac (no description set)
  @origin: urvnvxtx 7dac65ac (no description set)

You declare that you want a local Bookmark tracking foo@origin. Use this command:

$ jj bookmark track foo --remote=origin
Started tracking 1 remote bookmarks.
$jj log
@  p    (empty)
│ ○  s    foo
├─╯
◆  u    main
│
~

$ jj bookmark list foo
foo: stnkrwop 00687915 (no description set)
  @git: stnkrwop 00687915 (no description set)
  @origin: stnkrwop 00687915 (no description set)

Everything checks out:

  • A local Bookmark foo has been created.
  • Bound to it, a Git branch foo (foo@git) immediately appeared.
  • Finally, the remote Bookmark foo@origin is displayed, properly indented under foo, to signify that foo is tracking it.

Notice how, again, the 3 Bookmarks share the same name. This is a difference from Git, where a local branch can track a remote branch with a completely independent name.

Also note two things:

  • As expected, now jj log shows the Changes of foo:
@  p    (empty)
│ ○  s    foo
├─╯
◆  u    main
│
~
  • The Changes of foo are no longer immutable.

You should have understood by now why, in the past exercises, right after a jj git clone, I always invited you to do:

jj bookmark track "*" --remote origin

It served to make all the Changes mutable.

Tracking bar

Alright, track bar too:

Solution

Sure! jj bookmark track bar --remote=origin

You could also have abbreviated it as:

jj b t bar

Now the log shows:

@  p    (empty)
│ ○  s    foo
├─╯
│ ○  o    bar
├─╯
◆  u    main
│
~

All the Changes (except for those of the main trunk) are now mutable. As expected, each local Bookmark is tracking a respective Bookmark on git and on origin:

$ jj bookmark list -a
bar: ossuomlo fa22ec04 (no description set)
  @git: ossuomlo fa22ec04 (no description set)
  @origin: ossuomlo fa22ec04 (no description set)
foo: stnkrwop 00687915 (no description set)
  @git: stnkrwop 00687915 (no description set)
  @origin: stnkrwop 00687915 (no description set)
main: urvnvxtx 7dac65ac (no description set)
  @git: urvnvxtx 7dac65ac (no description set)
  @origin: urvnvxtx 7dac65ac (no description set)

Time to discover what happens when you move Bookmarks around and you play with fetch and push.