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 git_head() 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 now 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 git_head() 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.
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
.
When you create a new bookmark and push it to the remote, it automatically becomes tracked.
That's why we didn't have to worry about tracking until now.
However, when you clone a repository, only the main
bookmark will automatically become tracked.
All other bookmarks that exist on the remote remain untracked by default.
This is useful, because you may be working together with many other people on a project.
You are usually not interested in the work-in-progress of your peers.
Their bookmarks not being tracked by default also prevents you from accidentally pushing your own commits to their bookmarks.
That being said, 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 do that is:
jj bookmark track push-zkwmvzlqluot@origin
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 git_head() 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 ~