Moving and Pushing Bookmarks
Build a commit on top of foo:
jj new foo
echo "hello world" > hello.txt
@ k
○ s foo
│ ○ o bar
├─╯
◆ u main
│
~
As expected, the local Bookmark foo didn't follow you.
Moving Bookmarks
If you want to update foo so it points to the latest Change k, you
have 2 options:
- Use the
jj bookmark movecommand (jj b mfor short), explicitly indicating the target Change:
jj bookmark move foo -t k
- Let Jujutsu figure out how far forward to move
foo, with thejj bookmark advancecommand (jj b afor short)
jj bookmark advance
Misalignments
Look at what you get by moving foo:
$ jj log
@ k foo*
○ s foo@origin
│ ○ o bar
├─╯
◆ u main
│
~
Can you explain to yourself what this means? Let the output of jj bookmark list help you too:
Solution
Solution
jj bookmark list --all-remotes shows:
$ jj b l -a
foo: ksvskswq dd2904b3 (no description set)
@git: ksvskswq dd2904b3 (no description set)
@origin (behind by 1 commits): stnkrwop 00687915 (no description set)
- The local Bookmark
foois onk, aligned with its corresponding Git branch (foo@git). - The Bookmark on the
originremote stayed behind (behind by 1 commits), ons.
If you omit the --all-remotes / -a argument, Jujutsu would be
less verbose, showing you only the essentials:
$ jj b l foo
foo: ksvskswq dd2904b3 (no description set)
@origin (behind by 1 commits): stnkrwop 00687915 (no description set)
stating: foo and foo@origin don't match anymore.
It's the very same information you see the log, with foo*
and foo@origin:
@ k foo*
○ s foo@origin
│ ○ o
├─╯
◆ u
│
~
Pushing to Remotes
If you want foo@origin to align with your local foo, you need to
use push. The asterisk in foo* is Jujutsu's way of telling you
it's a good moment to do so:
jj git push --bookmark=foo --remote=origin
which you can abbreviate as:
jj git push -b foo
If you run it, you get:
Error: Won't push commit dd2904b35cee since it has no description
Hint: Rejected commit: ksvskswq dd2904b3 foo* | (no description set)
Ha, good boy! Jujutsu gives you a lot of freedom, locally, but when it
comes to sharing your work with remote Git repositories it sticks with
Git's conventions. In this case, Git isn't happy to receive commits
without a description, and Jujutsu avoids getting it worked up.
Fine, add a description:
jj desc -m "Hello, world"
jj git push -b foo
Log again and admire how Bookmarks are nicely aligned:
$ jj
@ k foo Hello, world
○ s
│ ○ o bar
├─╯
◆ u main
│
~
$ jj b l
bar: ossuomlo fa22ec04 (no description set)
foo: ksvskswq 938fe989 Hello, world
main: urvnvxtx 7dac65ac (no description set)