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

Fetching

Important

You learn to update from a remote.

Switch to your coworker’s perspective. Go to the theirs repository:

cd ../theirs
@  s    (empty)
◆  u    **main**
│
~

Only main is visible. Your coworker hasn’t declared intent to work on foo or bar, so they remain hidden:

jj bookmark list -a
**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)

Track all the Bookmarks:

jj bookmark track "*" --remote=origin
@  sz   (empty)
│ ○  st   **foo**
├─╯
│ ○  o    **bar**
├─╯
◆  u    **main**
│
~

There they are: all visible and mutable. Your coworker doesn’t see your Change k yet. This is like with Git: a repository aligns with its remotes only during fetch and push.

Here, foo@origin represents the last known position of foo on the remote origin. Time to refresh it.

Fetching From a Remote

jj git fetch
@  sz   (empty)
│ ○  k    Hello, world **foo**
│ ○  st
├─╯
│ ○  o    **bar**
├─╯
◆  u    **main**
│
~

There’s k! Notice foo (and foo@git) aligned with the new position of foo@origin:

jj bookmark list foo
**foo**: ksvskswq 938fe989 Hello, world
  **@git**: ksvskswq 938fe989 Hello, world
  **@origin**: ksvskswq 938fe989 Hello, world

In essence, jj git fetch tells Jujutsu to:

  • Retrieve all Changes from origin and integrate them locally.
  • Update the position of every remote Bookmark, if possible.
  • Align each local Bookmark to its tracked remote Bookmark, if possible.

Why did I say “if possible”? Because things don’t always go smoothly.

Indeed: enough with the happy path. Let’s see how to tackle the case where you and your coworker update the same remote Bookmark in irreconcilable ways. Finnaly, conflicts in Bookmarks.