Tracking remote bookmarks
Reset your progress
Reset your progress
To reset your progress to the start of this chapter, run the following command:
curl https://jj-for-everyone.github.io/reset.sh | bash -s track
cd ~/jj-tutorial/repo
Alice got herself a new laptop, which she's really excited about. It's a Framework laptop, because Alice has become tired of computer manufacturers making it intentionally difficult for her to fix her own hardware. Framework also has official support for Linux, which is very important to Alice. Hardware that respects the user and software that respects the user are a great match, Alice thinks.
Anyway, the point is: Alice doesn't have her repository anymore. She could've copied it over from her old computer, but since she can just clone the repo again, she didn't do that. Let's simulate Alice making a fresh clone of the repo:
cd ~ # move out of the directory we're about to delete
rm -rf ~/jj-tutorial/repo
jj git clone ~/jj-tutorial/remote ~/jj-tutorial/repo
cd ~/jj-tutorial/repo
# roleplay as Alice
jj config set --repo user.name "Alice"
jj config set --repo user.email "alice@local"
jj metaedit --update-author
Let's confirm everything went well with jj log:
@ yuxnowup alice@local 2025-08-23 20:01:42 1043cd89 │ (empty) (no description set) ◆ wkywrwmu bob@local 2025-08-23 20:01:22 main 36c08763 │ Add submission instructions ~
Hmm, we've got two problems here. Firstly, we are missing the commit with the German and French version of "Hello, world!" We actually never pushed that commit, so it only exists on Alice's old laptop... Unfortunately, that's now gone forever. The only thing we can do is to recreate it:
echo 'print("Hallo, Welt!")' >> hello.py
echo 'print("Bonjour, le monde!")' >> hello.py
jj commit -m "Print German and French grettings as well"
Take that as a reminder to always push your commits!
The remote doesn't work as a backup solution if you forget to push.
We can push this commit directly to the main bookmark:
jj bookmark move main -t @-
jj git push
The second problem is that we're missing the commit with the loop-experiment.
That one isn't actually lost, because we did push it to the remote (with an auto-generated bookmark).
It's just hidden by default, but we can find it with jj log --revisions 'all()':
@ nkvmznqz alice@local 2025-08-23 21:18:57 e579e9a8 │ (empty) (no description set) ◆ vmztslml alice@local 2025-08-23 21:18:57 main a928e18a │ Print German and French grettings as well ◆ vwkzzxum bob@local 2025-08-23 21:18:20 7a76ce52 │ Add submission instructions │ ◆ zkwmvzlq alice@local 2025-08-23 21:18:20 push-zkwmvzlqluot@origin a7cd6be9 ├─╯ WIP: Add for loop (need to fix syntax) ◆ pqoyoror alice@local 2025-08-23 21:18:20 94608da3 ├─╮ (empty) Merge code and documentation for hello-world │ ◆ owrwuqyr alice@local 2025-08-23 21:18:20 22f32788 │ │ Add Python script for greeting the world ◆ │ vpzorutw bob@local 2025-08-23 21:18:20 9148e791 ├─╯ Document hello.py in README.md ◆ pkpoursq alice@local 2025-08-23 21:18:20 02f136e2 │ Add project description to readme ◆ tkpkmszl alice@local 2025-08-23 21:18:20 66c2503f │ Add readme with project title ◆ zzzzzzzz root() 00000000
There it is.
The bookmark that points to the loop-experiment commit is displayed as push-zkwmvzlqluot@origin.
But what's up with @origin?
That wasn't there before.
It means that the bookmark only exists on the remote "origin", not locally.
We can fix this by tracking the bookmark, but let's talk about what that means in detail.
Bookmark tracking
Jujutsu has a concept of bookmarks being tracked or untracked.
If a bookmark is tracked, Jujutsu will try to keep its local and remote version in sync when you run jj git push and jj git fetch.
There are several reasons for this distinction.
For example, you may create bookmarks so you can refer to the commits they point to more easily, without any intention to push the commits to any remote.
The remote, on the other hand, may store bookmarks you don't care about locally, like the work-in-progress of your team members.
In both of these cases, having bookmarks makes sense.
But you don't want to transfer them between the local and the remote repository via jj git push and jj git fetch.
Until now, we didn't have to worry about the "tracking state" of a bookmark. We pushed new bookmarks to the remote with two different commands:
jj git push --bookmark <NAME>jj git push --change <REVISION>
Both of these commands automatically set the bookmark to tracking, because that's obviously what the user wants.
However, there is also the command jj git push, which can push several bookmarks at once.
With that command, Jujutsu will refuse to push bookmarks that haven't been tracked before.
The opposite situation is when a bookmark exists on the remote, but there is not tracking bookmark locally.
By default, the output of jj log doesn't show commits on remote-only bookmarks, because the user is probably not interested in them.
But the bookmark push-zkwmvzlqluot is not someone else's bookmark, it's Alice's.
She would like the bookmark to be tracked so she can see it by default in the log and so she can update and push it later.
The command to track the bookmark is:
jj bookmark track push-zkwmvzlqluot
Now, a regular jj log will show the bookmark again:
@ nkvmznqz alice@local 2025-08-23 21:18:57 e579e9a8 │ (empty) (no description set) ◆ vmztslml alice@local 2025-08-23 21:18:57 main a928e18a │ Print German and French grettings as well ~ (elided revisions) │ ○ zkwmvzlq alice@local 2025-08-23 21:18:20 push-zkwmvzlqluot a7cd6be9 ├─╯ WIP: Add for loop (need to fix syntax) ◆ pqoyoror alice@local 2025-08-23 21:18:20 94608da3 │ (empty) Merge code and documentation for hello-world ~