LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

jj-util

infrequently used Jujutsu utilities (completions, gc, exec)

TLDR

Generate bash completions
$ jj util completion bash
copy
Load zsh completions
$ source <(jj util completion zsh)
copy
Load fish completions
$ jj util completion fish | source
copy
Run garbage collection (objects older than two weeks)
$ jj util gc
copy
Garbage-collect immediately
$ jj util gc --expire now
copy
Snapshot the working copy (for scripts)
$ jj util snapshot
copy
Print the config JSON schema
$ jj util config-schema
copy
Print the storage backend name
$ jj util backend name
copy
Install man pages under a prefix (creates `man1/` etc.)
$ jj util install-man-pages [/usr/local/share/man]
copy

SYNOPSIS

jj util (completion | config-schema | exec | gc | install-man-pages | markdown-help | snapshot | backend) [args]

DESCRIPTION

jj util groups commands that are not part of the daily edit/rebase/push loop: shell completions, schema dumps, man-page install, explicit snapshots, and garbage collection.jj util gc only reclaims objects that are already unreachable. To drop old operation history first, run `jj op abandon ..<old-operation>` and then jj util gc.jj util exec exists so aliases can run arbitrary programs through jj. The child sees `JJWORKSPACEROOT`. Official docs warn that this is a convenience for running code on your system: a bad alias can break `jj undo` or destroy files, and the feature may be replaced by an embedded scripting language.jj util snapshot is the documented way to force a working-copy snapshot from a script (for example so a sandwich of snapshots around other jj commands keeps those operations distinct in `jj op log`). Humans almost never need it; `jj operation log --limit 1` also snapshots.

CONFIGURATION

Typical alias using exec (the `--` is required so flags reach the script):

$ [aliases]
my-script = ["util", "exec", "--", "my-jj-script"]
copy

SUBCOMMANDS

completion SHELL

Print a completion script. SHELL is one of bash, elvish, fish, nushell, power-shell, zsh.
config-schema
Print the JSON schema for jj's TOML config format.
exec COMMAND [ARGS...]
Run an external command with `JJWORKSPACEROOT` set. Intended for aliases. Put -- before the command so flags go to the child, not to jj.
gc [--expire now]
Backend-dependent garbage collection. Default: prune obsolete objects and operations older than two weeks. --expire currently accepts only the string now.
install-man-pages PATH
Write man pages under PATH (`man1/` is appended). Example: `/usr/share/man`.
markdown-help
Print CLI help for every subcommand as Markdown.
snapshot
Snapshot the working copy if it changed. Almost every jj command already does this; this subcommand is for scripts that need a distinct operation.
backend name
Print the name of the storage backend used by the current repo (typically `git`).

INSTALL

sudo pacman -S jujutsu
copy
sudo apk add jujutsu
copy
sudo zypper install jujutsu
copy
brew install jujutsu
copy
nix profile install nixpkgs#jujutsu
copy

CAVEATS

Subcommand of jj. gc --expire does not yet accept arbitrary timestamps. exec runs arbitrary commands. Completions must be regenerated after jj upgrades.

SEE ALSO

RESOURCES

Copied to clipboard
Kai