Adding more bookmarks
Reset your progress
Reset your progress
To reset your progress to the start of this chapter, run the following command:
curl https://s2p2.github.io/jj-for-everyone/reset.sh | bash -s more_bookmarks
cd ~/jj-tutorial/repo
Let's switch back to Alice:
cd ~/jj-tutorial/repo
Alice attempts to get ahead by adding a loop to the program:
echo 'for (i = 0; i < 10; i = i + 1):
print("Hello, world!")' > hello.py
Unfortunately, running python hello.py prints an error:
File "/home/user/jj-tutorial/repo/hello.py", line 1
for (i = 0; i < 10; i = i + 1):
^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
She wants to save this experiment for later reference without breaking main. First, she commits:
jj commit -m "WIP: Add for loop (need to fix syntax)"
Pushing this work-in-progress (WIP) commit to main would be a mistake. The main bookmark should always point to stable, working code. Anyone else pulling from main would get her broken code, potentially blocking their work or getting it accidentally included in a project submission.
To share her experiment safely, she can push it to a separate bookmark. While she could name it manually (e.g., alice/add-for-loop), she can also let Jujutsu generate a name and push immediately:
jj git push --change @-
@ qrtwnykn alice@local 2025-07-25 20:37:05 c2f4e43e │ (empty) (no description set) ○ rvpkroku alice@local 2025-07-25 20:37:05 push-rvpkrokuqrxt git_head() b9d02faf │ WIP: Add for loop (need to fix syntax) ◆ stlxrmun alice@local 2025-07-25 20:37:05 main 530ad636 │ (empty) Merge code and documentation for hello-world ~
Jujutsu generated the bookmark push-blabla using the change ID.
Note: You can abbreviate --change as -c. Use jj git push --help to see more available flags.
Tracking the new bookmark is also handled automatically for the same reason, so there's no need to run jj bookmark track.
Alice's experiment is now safely stored on the remote without interfering with main.