Tracked and Tracking Bookmarks
Important
You learn to control remote branches.
A local Bookmark can be bound to a remote Bookmark. They follow each other based on these roles:
| Bookmark | Role | Meaning |
|---|---|---|
| Local | Tracking | Monitors the position of a remote Bookmark and tries to stay aligned with its position, following a git fetch |
| Remote | Tracked | Tries to align with the position of a local Bookmark during a git push. |
Remotes in Practice
Let’s create 3 local repositories:
| Repository | Description |
|---|---|
project-remote | A bare Git repo to act as the remote. |
ours | A clone of project-remote. Your working repo. |
theirs | Another clone. The working repo of a hypothetical coworker. |
There are only 3 commits, but don’t worry: it’s plenty to chew on.
git clone ssh://git@codeberg.org/arialdo/jj-remote.git project-remote --bare
jj git clone project-remote ours
jj git clone project-remote theirs
cd ours
Displaying Remote Bookmarks
By default, Git and Jujutsu only show the main branch.
git log --oneline --graph
* 7dac65a (**HEAD**, **origin/main**, **main**)
jj log
@ p (empty)
◆ u **main**
│
~
Remote branches are displayed only when asked explicitely:
git branch -a
* (no branch)
**main**
**remotes/origin/bar**
**remotes/origin/foo**
**remotes/origin/main**
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)
This means:
barexists only onorigin.fooexists only onorigin.mainexists as a local Bookmark, as a branch ongit, and as a remote Bookmark onorigin.
The indentation under main helps you see that it tracks both git
and origin. Jujutsu will try to keep these 3 bookmarks
aligned. Right now, all point to 7dac65ac.