✨ 100% local LLM-based bookmark (Git branch) name creation for Jujutsu VCS
Jujutsu is a modern, Git-compatible VCS. It supports (and I primarily use) anonymous branches for development. Since Git, and thus all Git-based “forges” (GitHub, GitLab, Bitbucket, etc.) require branch names, though, you need to give a branch name when you push your changes for others to work with.
Jujutsu has native support making this easy. If you run jj git push --change <change ID>,it creates a Jujutsu bookmark (which it maps to Git branches) and then pushes that newly created bookmark. The bookmark names it creates are of the form push-<change id>, though. Those are not especially attractive to most collaborators!
This tiny tool is one “solution”: it generates a bookmark name based on the messages associated with the changes you tell it to use—by default, trunk()..@, or “everything between my current working copy and whatever the ‘trunk’ is for this project (usually main or master”).
gpc is short for git push change.
Prerequisites: a relatively recent version of Rust. (I built it with Rust 1.82, but it probably works with versions quite a bit earlier than that!)
-
Clone the repo.
With Jujutsu:
jj git clone https://github.com/chriskrycho/jj-gpc
With Git:
git clone https://github.com/chriskrycho/jj-gpc.git
-
Install it with Cargo:
cargo install --path . --locked -
Install and run ollama.
-
Fetch the
phi3model:ollama pull phi3
That’s it; now you can run jj-gpc to do this.
jj-gpc [change] [flags]
change is the revset to use to generate the bookmark name. If not passed, it will use @.
A few of the most useful flags:
-f/--from: the initial revision to use in the revset for generating the name. Note that the revset is of the form<from>..<change>, so the<from>message will not be included, because the default istrunk(), and the point is to generate a description of what is different from the trunk.-p/--prefix: apply a prefix before the generated bookmark name. For example,jj-gpc -p chriskrychowould produce a name likechriskrycho/did-some-stuff, instead of justdid-some-stuff.--log-format: passone-line(the default) to pass just summary messages, orfullto pass the whole commit message, to the LLM for branch name description.--dry-run: generate a branch name but neither create the bookmark nor push it.
For the full set of flags and more details, run jj-gpc --help!
A handful of branch names I have actually seen generated by this:
update-infra-issuesupdate-mdbook-dependenciessoftware-updates-implementedcleaning-and-fixessmall-bug-fixessmall-code-updatesadd-some-examplessmall-digital-notebookfix-library-errorsbump-typescript-versionsupport-ts-versions