jj-vcs/jj

FR: Better defaults for `trunk()`

Open

#7990 opened on Nov 10, 2025

View on GitHub
 (27 comments) (0 reactions) (1 assignee)Rust (28,830 stars) (1,052 forks)batch import
good first issue

Description

As discussed in https://discord.com/channels/968932220549103686/1436372580000075978, the current default for trunk() seems to have some drawbacks.

  • root() as fallback is unlucky, if you have none of the previous options, root() is considered the trunk() which means that with the default log revset, root() is always shown. And it also means that if you do something like jj rebase -d trunk(), chances are high that you get an error about immutable commits not being rebased unless you have no immutable commits yet. I have a gut feeling that none() would be better than root(), so that if you try to do something with trunk() you get an imho better error that the revset is empty, and jj log will not by default always show the root() commit.

  • it might make sense to coalesce first the latest of the remote bookmarks considered now, then to the latest local bookmark with one of the three names, and only after that either fall back to root() or - as noted in the first point - to none().

  • When jj git init is used to create a new empty repository, trunk() alias should be set to the one branch that is now available in Git.

  • When jj git init is used to create a JJ repo on an existing purely-local Git repository, it should also set the trunk() alias like when doing it on a repo with remotes or when doing jj git clone.

Contributor guide