Warning
This CLI reference is experimental. It is automatically generated, but
does not match the jj help
output exactly.
Run jj help <COMMAND>
for more authoritative documentation.
If you see a significant difference, feel free to file a bug, or a PR to note the difference here.
Command-Line Help for jj
¶
This document contains the help content for the jj
command-line program.
Command Overview:
jj
↴jj abandon
↴jj absorb
↴jj backout
↴jj bookmark
↴jj bookmark create
↴jj bookmark delete
↴jj bookmark forget
↴jj bookmark list
↴jj bookmark move
↴jj bookmark rename
↴jj bookmark set
↴jj bookmark track
↴jj bookmark untrack
↴jj commit
↴jj config
↴jj config edit
↴jj config get
↴jj config list
↴jj config path
↴jj config set
↴jj config unset
↴jj describe
↴jj diff
↴jj diffedit
↴jj duplicate
↴jj edit
↴jj evolog
↴jj file
↴jj file annotate
↴jj file chmod
↴jj file list
↴jj file show
↴jj file track
↴jj file untrack
↴jj fix
↴jj git
↴jj git clone
↴jj git export
↴jj git fetch
↴jj git import
↴jj git init
↴jj git push
↴jj git remote
↴jj git remote add
↴jj git remote list
↴jj git remote remove
↴jj git remote rename
↴jj git remote set-url
↴jj help
↴jj init
↴jj interdiff
↴jj log
↴jj new
↴jj next
↴jj operation
↴jj operation abandon
↴jj operation diff
↴jj operation log
↴jj operation restore
↴jj operation show
↴jj operation undo
↴jj parallelize
↴jj prev
↴jj rebase
↴jj resolve
↴jj restore
↴jj root
↴jj show
↴jj simplify-parents
↴jj sparse
↴jj sparse edit
↴jj sparse list
↴jj sparse reset
↴jj sparse set
↴jj split
↴jj squash
↴jj status
↴jj tag
↴jj tag list
↴jj util
↴jj util completion
↴jj util config-schema
↴jj util exec
↴jj util gc
↴jj util mangen
↴jj util markdown-help
↴jj undo
↴jj version
↴jj workspace
↴jj workspace add
↴jj workspace forget
↴jj workspace list
↴jj workspace rename
↴jj workspace root
↴jj workspace update-stale
↴
jj
¶
Jujutsu (An experimental VCS)
To get started, see the tutorial at https://martinvonz.github.io/jj/latest/tutorial/.
Usage: jj [OPTIONS] [COMMAND]
'jj help --help' list available keywords. Use 'jj help -k' to show help for one of these keywords.
Subcommands:¶
abandon
— Abandon a revisionabsorb
— Move changes from a revision into the stack of mutable revisionsbackout
— Apply the reverse of a revision on top of another revisionbookmark
— Manage bookmarks [default alias: b]commit
— Update the description and create a new change on topconfig
— Manage config optionsdescribe
— Update the change description or other metadatadiff
— Compare file contents between two revisionsdiffedit
— Touch up the content changes in a revision with a diff editorduplicate
— Create new changes with the same content as existing onesedit
— Sets the specified revision as the working-copy revisionevolog
— Show how a change has evolved over timefile
— File operationsfix
— Update files with formatting fixes or other changesgit
— Commands for working with Git remotes and the underlying Git repohelp
— Print this message or the help of the given subcommand(s)init
— Create a new repo in the given directoryinterdiff
— Compare the changes of two commitslog
— Show revision historynew
— Create a new, empty change and (by default) edit it in the working copynext
— Move the working-copy commit to the child revisionoperation
— Commands for working with the operation logparallelize
— Parallelize revisions by making them siblingsprev
— Change the working copy revision relative to the parent revisionrebase
— Move revisions to different parent(s)resolve
— Resolve a conflicted file with an external merge toolrestore
— Restore paths from another revisionroot
— Show the current workspace root directoryshow
— Show commit description and changes in a revisionsimplify-parents
— Simplify parent edges for the specified revision(s)sparse
— Manage which paths from the working-copy commit are present in the working copysplit
— Split a revision in twosquash
— Move changes from a revision into another revisionstatus
— Show high-level repo statustag
— Manage tagsutil
— Infrequently used commands such as for generating shell completionsundo
— Undo an operation (shortcut forjj op undo
)version
— Display version informationworkspace
— Commands for working with workspaces
Options:¶
-
-R
,--repository <REPOSITORY>
— Path to repository to operate onBy default, Jujutsu searches for the closest .jj/ directory in an ancestor of the current working directory.
-
--ignore-working-copy
— Don't snapshot the working copy, and don't update itBy default, Jujutsu snapshots the working copy at the beginning of every command. The working copy is also updated at the end of the command, if the command modified the working-copy commit (
@
). If you want to avoid snapshotting the working copy and instead see a possibly stale working-copy commit, you can use--ignore-working-copy
. This may be useful e.g. in a command prompt, especially if you have another process that commits the working copy.Loading the repository at a specific operation with
--at-operation
implies--ignore-working-copy
. -
--ignore-immutable
— Allow rewriting immutable commitsBy default, Jujutsu prevents rewriting commits in the configured set of immutable commits. This option disables that check and lets you rewrite any commit but the root commit.
This option only affects the check. It does not affect the
immutable_heads()
revset or theimmutable
template keyword. -
--at-operation <AT_OPERATION>
— Operation to load the repo atOperation to load the repo at. By default, Jujutsu loads the repo at the most recent operation, or at the merge of the divergent operations if any.
You can use
--at-op=<operation ID>
to see what the repo looked like at an earlier operation. For examplejj --at-op=<operation ID> st
will show you whatjj st
would have shown you when the given operation had just finished.--at-op=@
is pretty much the same as the default except that divergent operations will never be merged.Use
jj op log
to find the operation ID you want. Any unambiguous prefix of the operation ID is enough.When loading the repo at an earlier operation, the working copy will be ignored, as if
--ignore-working-copy
had been specified.It is possible to run mutating commands when loading the repo at an earlier operation. Doing that is equivalent to having run concurrent commands starting at the earlier operation. There's rarely a reason to do that, but it is possible.
-
--debug
— Enable debug logging --color <WHEN>
— When to colorize output (always, never, debug, auto)-
--quiet
— Silence non-primary command outputFor example,
jj file list
will still list files, but it won't tell you if the working copy was snapshotted or if descendants were rebased.Warnings and errors will still be printed.
-
--no-pager
— Disable the pager -
--config <NAME=VALUE>
— Additional configuration options (can be repeated)The name should be specified as TOML dotted keys. The value should be specified as a TOML expression. If string value doesn't contain any TOML constructs (such as array notation), quotes can be omitted.
-
--config-file <PATH>
— Additional configuration files (can be repeated)
jj abandon
¶
Abandon a revision
Abandon a revision, rebasing descendants onto its parent(s). The behavior is similar to jj restore --changes-in
; the difference is that jj abandon
gives you a new change, while jj restore
updates the existing change.
If a working-copy commit gets abandoned, it will be given a new, empty commit. This is true in general; it is not specific to this command.
Usage: jj abandon [OPTIONS] [REVISIONS]...
Arguments:¶
-
<REVISIONS>
— The revision(s) to abandonDefault value:
@
Options:¶
-s
,--summary
— Do not print every abandoned commit on a separate line--restore-descendants
— Do not modify the content of the children of the abandoned commits
jj absorb
¶
Move changes from a revision into the stack of mutable revisions
This command splits changes in the source revision and moves each change to the closest mutable ancestor where the corresponding lines were modified last. If the destination revision cannot be determined unambiguously, the change will be left in the source revision.
The modification made by jj absorb
can be reviewed by jj op show -p
.
Usage: jj absorb [OPTIONS] [PATHS]...
Arguments:¶
<PATHS>
— Move only changes to these paths (instead of all paths)
Options:¶
-
-f
,--from <FROM>
— Source revision to absorb fromDefault value:
@
-
-t
,--into <INTO>
— Destination revisions to absorb intoOnly ancestors of the source revision will be considered.
Default value:
mutable()
jj backout
¶
Apply the reverse of a revision on top of another revision
Usage: jj backout [OPTIONS]
Options:¶
-
-r
,--revisions <REVISIONS>
— The revision(s) to apply the reverse ofDefault value:
@
-
-d
,--destination <DESTINATION>
— The revision to apply the reverse changes on top ofDefault value:
@
jj bookmark
¶
Manage bookmarks [default alias: b]
For information about bookmarks, see https://martinvonz.github.io/jj/latest/bookmarks.
Usage: jj bookmark <COMMAND>
Subcommands:¶
create
— Create a new bookmarkdelete
— Delete an existing bookmark and propagate the deletion to remotes on the next pushforget
— Forget everything about a bookmark, including its local and remote targetslist
— List bookmarks and their targetsmove
— Move existing bookmarks to target revisionrename
— Renameold
bookmark name tonew
bookmark nameset
— Create or update a bookmark to point to a certain committrack
— Start tracking given remote bookmarksuntrack
— Stop tracking given remote bookmarks
jj bookmark create
¶
Create a new bookmark
Usage: jj bookmark create [OPTIONS] <NAMES>...
Arguments:¶
<NAMES>
— The bookmarks to create
Options:¶
-r
,--revision <REVISION>
— The bookmark's target revision
jj bookmark delete
¶
Delete an existing bookmark and propagate the deletion to remotes on the next push
Usage: jj bookmark delete <NAMES>...
Arguments:¶
-
<NAMES>
— The bookmarks to deleteBy default, the specified name matches exactly. Use
glob:
prefix to select bookmarks by wildcard pattern. For details, see https://martinvonz.github.io/jj/latest/revsets/#string-patterns.
jj bookmark forget
¶
Forget everything about a bookmark, including its local and remote targets
A forgotten bookmark will not impact remotes on future pushes. It will be recreated on future pulls if it still exists in the remote.
Usage: jj bookmark forget <NAMES>...
Arguments:¶
-
<NAMES>
— The bookmarks to forgetBy default, the specified name matches exactly. Use
glob:
prefix to select bookmarks by wildcard pattern. For details, see https://martinvonz.github.io/jj/latest/revsets/#string-patterns.
jj bookmark list
¶
List bookmarks and their targets
By default, a tracking remote bookmark will be included only if its target is different from the local target. A non-tracking remote bookmark won't be listed. For a conflicted bookmark (both local and remote), old target revisions are preceded by a "-" and new target revisions are preceded by a "+".
For information about bookmarks, see https://martinvonz.github.io/jj/latest/bookmarks/.
Usage: jj bookmark list [OPTIONS] [NAMES]...
Arguments:¶
-
<NAMES>
— Show bookmarks whose local name matchesBy default, the specified name matches exactly. Use
glob:
prefix to select bookmarks by wildcard pattern. For details, see https://martinvonz.github.io/jj/latest/revsets/#string-patterns.
Options:¶
-a
,--all-remotes
— Show all tracking and non-tracking remote bookmarks including the ones whose targets are synchronized with the local bookmarks-
--remote <REMOTE>
— Show all tracking and non-tracking remote bookmarks belonging to this remoteCan be combined with
--tracked
or--conflicted
to filter the bookmarks shown (can be repeated.)By default, the specified remote name matches exactly. Use
glob:
prefix to select remotes by wildcard pattern. For details, see https://martinvonz.github.io/jj/latest/revsets/#string-patterns. -
-t
,--tracked
— Show remote tracked bookmarks only. Omits local Git-tracking bookmarks by default -c
,--conflicted
— Show conflicted bookmarks only-
-r
,--revisions <REVISIONS>
— Show bookmarks whose local targets are in the given revisionsNote that
-r deleted_bookmark
will not work sincedeleted_bookmark
wouldn't have a local target. -
-T
,--template <TEMPLATE>
— Render each bookmark using the given templateAll 0-argument methods of the
RefName
type are available as keywords.For the syntax, see https://martinvonz.github.io/jj/latest/templates/
jj bookmark move
¶
Move existing bookmarks to target revision
If bookmark names are given, the specified bookmarks will be updated to point to the target revision.
If --from
options are given, bookmarks currently pointing to the specified revisions will be updated. The bookmarks can also be filtered by names.
Example: pull up the nearest bookmarks to the working-copy parent
$ jj bookmark move --from 'heads(::@- & bookmarks())' --to @-
Usage: jj bookmark move [OPTIONS] <--from <REVISIONS>|NAMES>
Arguments:¶
-
<NAMES>
— Move bookmarks matching the given name patternsBy default, the specified name matches exactly. Use
glob:
prefix to select bookmarks by wildcard pattern. For details, see https://martinvonz.github.io/jj/latest/revsets/#string-patterns.
Options:¶
--from <REVISIONS>
— Move bookmarks from the given revisions-
--to <REVISION>
— Move bookmarks to this revisionDefault value:
@
-
-B
,--allow-backwards
— Allow moving bookmarks backwards or sideways
jj bookmark rename
¶
Rename old
bookmark name to new
bookmark name
The new bookmark name points at the same commit as the old bookmark name.
Usage: jj bookmark rename <OLD> <NEW>
Arguments:¶
<OLD>
— The old name of the bookmark<NEW>
— The new name of the bookmark
jj bookmark set
¶
Create or update a bookmark to point to a certain commit
Usage: jj bookmark set [OPTIONS] <NAMES>...
Arguments:¶
<NAMES>
— The bookmarks to update
Options:¶
-r
,--revision <REVISION>
— The bookmark's target revision-B
,--allow-backwards
— Allow moving the bookmark backwards or sideways
jj bookmark track
¶
Start tracking given remote bookmarks
A tracking remote bookmark will be imported as a local bookmark of the same name. Changes to it will propagate to the existing local bookmark on future pulls.
Usage: jj bookmark track <BOOKMARK@REMOTE>...
Arguments:¶
-
<BOOKMARK@REMOTE>
— Remote bookmarks to trackBy default, the specified name matches exactly. Use
glob:
prefix to select bookmarks by wildcard pattern. For details, see https://martinvonz.github.io/jj/latest/revsets/#string-patterns.Examples: bookmark@remote, glob:main@, glob:jjfan-@upstream
jj bookmark untrack
¶
Stop tracking given remote bookmarks
A non-tracking remote bookmark is just a pointer to the last-fetched remote bookmark. It won't be imported as a local bookmark on future pulls.
Usage: jj bookmark untrack <BOOKMARK@REMOTE>...
Arguments:¶
-
<BOOKMARK@REMOTE>
— Remote bookmarks to untrackBy default, the specified name matches exactly. Use
glob:
prefix to select bookmarks by wildcard pattern. For details, see https://martinvonz.github.io/jj/latest/revsets/#string-patterns.Examples: bookmark@remote, glob:main@, glob:jjfan-@upstream
jj commit
¶
Update the description and create a new change on top
Usage: jj commit [OPTIONS] [PATHS]...
Arguments:¶
<PATHS>
— Put these paths in the first commit
Options:¶
-i
,--interactive
— Interactively choose which changes to include in the first commit--tool <NAME>
— Specify diff editor to be used (implies --interactive)-m
,--message <MESSAGE>
— The change description to use (don't open editor)-
--reset-author
— Reset the author to the configured userThis resets the author name, email, and timestamp.
You can use it in combination with the JJ_USER and JJ_EMAIL environment variables to set a different author:
$ JJ_USER='Foo Bar' JJ_EMAIL=foo@bar.com jj commit --reset-author
-
--author <AUTHOR>
— Set author to the provided stringThis changes author name and email while retaining author timestamp for non-discardable commits.
jj config
¶
Manage config options
Operates on jj configuration, which comes from the config file and environment variables.
For file locations, supported config options, and other details about jj config, see https://martinvonz.github.io/jj/latest/config/.
Usage: jj config <COMMAND>
Subcommands:¶
edit
— Start an editor on a jj config fileget
— Get the value of a given config option.list
— List variables set in config file, along with their valuespath
— Print the path to the config fileset
— Update config file to set the given option to a given valueunset
— Update config file to unset the given option
jj config edit
¶
Start an editor on a jj config file.
Creates the file if it doesn't already exist regardless of what the editor does.
Usage: jj config edit <--user|--repo>
Options:¶
--user
— Target the user-level config--repo
— Target the repo-level config
jj config get
¶
Get the value of a given config option.
Unlike jj config list
, the result of jj config get
is printed without
extra formatting and therefore is usable in scripting. For example:
$ jj config list user.name user.name="Martin von Zweigbergk" $ jj config get user.name Martin von Zweigbergk
Usage: jj config get <NAME>
Arguments:¶
<NAME>
jj config list
¶
List variables set in config file, along with their values
Usage: jj config list [OPTIONS] [NAME]
Arguments:¶
<NAME>
— An optional name of a specific config option to look up
Options:¶
--include-defaults
— Whether to explicitly include built-in default values in the list--include-overridden
— Allow printing overridden values--user
— Target the user-level config--repo
— Target the repo-level config-
-T
,--template <TEMPLATE>
— Render each variable using the given templateThe following keywords are defined:
name: String
: Config name.value: String
: Serialized value in TOML syntax.overridden: Boolean
: True if the value is shadowed by other.
For the syntax, see https://martinvonz.github.io/jj/latest/templates/
jj config path
¶
Print the path to the config file
A config file at that path may or may not exist.
See jj config edit
if you'd like to immediately edit the file.
Usage: jj config path <--user|--repo>
Options:¶
--user
— Target the user-level config--repo
— Target the repo-level config
jj config set
¶
Update config file to set the given option to a given value
Usage: jj config set <--user|--repo> <NAME> <VALUE>
Arguments:¶
<NAME>
-
<VALUE>
— New value to setThe value should be specified as a TOML expression. If string value doesn't contain any TOML constructs (such as array notation), quotes can be omitted.
Options:¶
--user
— Target the user-level config--repo
— Target the repo-level config
jj config unset
¶
Update config file to unset the given option
Usage: jj config unset <--user|--repo> <NAME>
Arguments:¶
<NAME>
Options:¶
--user
— Target the user-level config--repo
— Target the repo-level config
jj describe
¶
Update the change description or other metadata
Starts an editor to let you edit the description of changes. The editor will be $EDITOR, or pico
if that's not defined (Notepad
on Windows).
Usage: jj describe [OPTIONS] [REVISIONS]...
Arguments:¶
-
<REVISIONS>
— The revision(s) whose description to editDefault value:
@
Options:¶
-
-m
,--message <MESSAGE>
— The change description to use (don't open editor)If multiple revisions are specified, the same description will be used for all of them.
-
--stdin
— Read the change description from stdinIf multiple revisions are specified, the same description will be used for all of them.
-
--no-edit
— Don't open an editorThis is mainly useful in combination with e.g.
--reset-author
. -
--reset-author
— Reset the author to the configured userThis resets the author name, email, and timestamp.
You can use it in combination with the JJ_USER and JJ_EMAIL environment variables to set a different author:
$ JJ_USER='Foo Bar' JJ_EMAIL=foo@bar.com jj describe --reset-author
-
--author <AUTHOR>
— Set author to the provided stringThis changes author name and email while retaining author timestamp for non-discardable commits.
jj diff
¶
Compare file contents between two revisions
With the -r
option, which is the default, shows the changes compared to the parent revision. If there are several parent revisions (i.e., the given revision is a merge), then they will be merged and the changes from the result to the given revision will be shown.
With the --from
and/or --to
options, shows the difference from/to the given revisions. If either is left out, it defaults to the working-copy commit. For example, jj diff --from main
shows the changes from "main" (perhaps a bookmark name) to the working-copy commit.
Usage: jj diff [OPTIONS] [PATHS]...
Arguments:¶
<PATHS>
— Restrict the diff to these paths
Options:¶
-
-r
,--revision <REVISION>
— Show changes in this revision, compared to its parent(s)If the revision is a merge commit, this shows changes from the automatic merge of the contents of all of its parents to the contents of the revision itself.
-
-f
,--from <FROM>
— Show changes from this revision -t
,--to <TO>
— Show changes to this revision-s
,--summary
— For each path, show only whether it was modified, added, or deleted--stat
— Show a histogram of the changes-
--types
— For each path, show only its type before and afterThe diff is shown as two letters. The first letter indicates the type before and the second letter indicates the type after. '-' indicates that the path was not present, 'F' represents a regular file, `L' represents a symlink, 'C' represents a conflict, and 'G' represents a Git submodule.
-
--name-only
— For each path, show only its pathTypically useful for shell commands like:
jj diff -r @- --name_only | xargs perl -pi -e's/OLD/NEW/g
-
--git
— Show a Git-format diff --color-words
— Show a word-level diff with changes indicated only by color--tool <TOOL>
— Generate diff by external command--context <CONTEXT>
— Number of lines of context to show-w
,--ignore-all-space
— Ignore whitespace when comparing lines-b
,--ignore-space-change
— Ignore changes in amount of whitespace when comparing lines
jj diffedit
¶
Touch up the content changes in a revision with a diff editor
With the -r
option, which is the default, starts a diff editor on the changes in the revision.
With the --from
and/or --to
options, starts a diff editor comparing the "from" revision to the "to" revision.
Edit the right side of the diff until it looks the way you want. Once you close the editor, the revision specified with -r
or --to
will be updated. Unless --restore-descendants
is used, descendants will be rebased on top as usual, which may result in conflicts.
See jj restore
if you want to move entire files from one revision to another. For moving changes between revisions, see jj squash -i
.
Usage: jj diffedit [OPTIONS]
Options:¶
-
-r
,--revision <REVISION>
— The revision to touch upDefaults to @ if neither --to nor --from are specified.
-
-f
,--from <FROM>
— Show changes from this revisionDefaults to @ if --to is specified.
-
-t
,--to <TO>
— Edit changes in this revisionDefaults to @ if --from is specified.
-
--tool <NAME>
— Specify diff editor to be used -
--restore-descendants
— Preserve the content (not the diff) when rebasing descendantsWhen rebasing a descendant on top of the rewritten revision, its diff compared to its parent(s) is normally preserved, i.e. the same way that descendants are always rebased. This flag makes it so the content/state is preserved instead of preserving the diff.
jj duplicate
¶
Create new changes with the same content as existing ones
When none of the --destination
, --insert-after
, or --insert-before
arguments are provided, commits will be duplicated onto their existing parents or onto other newly duplicated commits.
When any of the --destination
, --insert-after
, or --insert-before
arguments are provided, the roots of the specified commits will be duplicated onto the destination indicated by the arguments. Other specified commits will be duplicated onto these newly duplicated commits. If the --insert-after
or --insert-before
arguments are provided, the new children indicated by the arguments will be rebased onto the heads of the specified commits.
Usage: jj duplicate [OPTIONS] [REVISIONS]...
Arguments:¶
<REVISIONS>
— The revision(s) to duplicate (default: @)
Options:¶
-d
,--destination <DESTINATION>
— The revision(s) to duplicate onto (can be repeated to create a merge commit)-A
,--insert-after <INSERT_AFTER>
— The revision(s) to insert after (can be repeated to create a merge commit)-B
,--insert-before <INSERT_BEFORE>
— The revision(s) to insert before (can be repeated to create a merge commit)
jj edit
¶
Sets the specified revision as the working-copy revision
Note: it is generally recommended to instead use jj new
and jj squash
.
For more information, see https://martinvonz.github.io/jj/latest/FAQ#how-do-i-resume-working-on-an-existing-change
Usage: jj edit <REVISION>
Arguments:¶
<REVISION>
— The commit to edit
jj evolog
¶
Show how a change has evolved over time
Lists the previous commits which a change has pointed to. The current commit of a change evolves when the change is updated, rebased, etc.
Usage: jj evolog [OPTIONS]
Options:¶
-
-r
,--revision <REVISION>
Default value:
@
-
-n
,--limit <LIMIT>
— Limit number of revisions to show --no-graph
— Don't show the graph, show a flat list of revisions-
-T
,--template <TEMPLATE>
— Render each revision using the given templateFor the syntax, see https://martinvonz.github.io/jj/latest/templates/
-
-p
,--patch
— Show patch compared to the previous version of this changeIf the previous version has different parents, it will be temporarily rebased to the parents of the new version, so the diff is not contaminated by unrelated changes.
-
-s
,--summary
— For each path, show only whether it was modified, added, or deleted --stat
— Show a histogram of the changes-
--types
— For each path, show only its type before and afterThe diff is shown as two letters. The first letter indicates the type before and the second letter indicates the type after. '-' indicates that the path was not present, 'F' represents a regular file, `L' represents a symlink, 'C' represents a conflict, and 'G' represents a Git submodule.
-
--name-only
— For each path, show only its pathTypically useful for shell commands like:
jj diff -r @- --name_only | xargs perl -pi -e's/OLD/NEW/g
-
--git
— Show a Git-format diff --color-words
— Show a word-level diff with changes indicated only by color--tool <TOOL>
— Generate diff by external command--context <CONTEXT>
— Number of lines of context to show--ignore-all-space
— Ignore whitespace when comparing lines--ignore-space-change
— Ignore changes in amount of whitespace when comparing lines
jj file
¶
File operations
Usage: jj file <COMMAND>
Subcommands:¶
annotate
— Show the source change for each line of the target filechmod
— Sets or removes the executable bit for paths in the repolist
— List files in a revisionshow
— Print contents of files in a revisiontrack
— Start tracking specified paths in the working copyuntrack
— Stop tracking specified paths in the working copy
jj file annotate
¶
Show the source change for each line of the target file.
Annotates a revision line by line. Each line includes the source change that introduced the associated line. A path to the desired file must be provided. The per-line prefix for each line can be customized via template with the templates.annotate_commit_summary
config variable.
Usage: jj file annotate [OPTIONS] <PATH>
Arguments:¶
<PATH>
— the file to annotate
Options:¶
-r
,--revision <REVISION>
— an optional revision to start at
jj file chmod
¶
Sets or removes the executable bit for paths in the repo
Unlike the POSIX chmod
, jj file chmod
also works on Windows, on conflicted files, and on arbitrary revisions.
Usage: jj file chmod [OPTIONS] <MODE> <PATHS>...
Arguments:¶
-
<MODE>
Possible values:
n
: Make a path non-executable (alias: normal)x
: Make a path executable (alias: executable)
-
<PATHS>
— Paths to change the executable bit for
Options:¶
-
-r
,--revision <REVISION>
— The revision to updateDefault value:
@
jj file list
¶
List files in a revision
Usage: jj file list [OPTIONS] [PATHS]...
Arguments:¶
<PATHS>
— Only list files matching these prefixes (instead of all files)
Options:¶
-
-r
,--revision <REVISION>
— The revision to list files inDefault value:
@
jj file show
¶
Print contents of files in a revision
If the given path is a directory, files in the directory will be visited recursively.
Usage: jj file show [OPTIONS] <PATHS>...
Arguments:¶
<PATHS>
— Paths to print
Options:¶
-
-r
,--revision <REVISION>
— The revision to get the file contents fromDefault value:
@
jj file track
¶
Start tracking specified paths in the working copy
Without arguments, all paths that are not ignored will be tracked.
New files in the working copy can be automatically tracked. You can configure which paths to automatically track by setting snapshot.auto-track
(e.g. to "none()"
or "glob:**/*.rs"
). Files that don't match the pattern can be manually tracked using this command. The default pattern is all()
and this command has no effect.
Usage: jj file track <PATHS>...
Arguments:¶
<PATHS>
— Paths to track
jj file untrack
¶
Stop tracking specified paths in the working copy
Usage: jj file untrack <PATHS>...
Arguments:¶
-
<PATHS>
— Paths to untrack. They must already be ignored.The paths could be ignored via a .gitignore or .git/info/exclude (in colocated repos).
jj fix
¶
Update files with formatting fixes or other changes
The primary use case for this command is to apply the results of automatic
code formatting tools to revisions that may not be properly formatted yet.
It can also be used to modify files with other tools like sed
or sort
.
The changed files in the given revisions will be updated with any fixes determined by passing their file content through any external tools the user has configured for those files. Descendants will also be updated by passing their versions of the same files through the same tools, which will ensure that the fixes are not lost. This will never result in new conflicts. Files with existing conflicts will be updated on all sides of the conflict, which can potentially increase or decrease the number of conflict markers.
The external tools must accept the current file content on standard input, and return the updated file content on standard output. A tool's output will not be used unless it exits with a successful exit code. Output on standard error will be passed through to the terminal.
Tools are defined in a table where the keys are arbitrary identifiers and the values have the following properties:
command
: The arguments used to run the tool. The first argument is the path to an executable file. Arguments can contain the substring$path
, which will be replaced with the repo-relative path of the file being fixed. It is useful to provide the path to tools that include the path in error messages, or behave differently based on the directory or file name.patterns
: Determines which files the tool will affect. If this list is empty, no files will be affected by the tool. If there are multiple patterns, the tool is applied only once to each file in the union of the patterns.
For example, the following configuration defines how two code formatters
(clang-format
and black
) will apply to three different file extensions
(.cc
, .h
, and .py
):
[fix.tools.clang-format]
command = ["/usr/bin/clang-format", "--assume-filename=$path"]
patterns = ["glob:'**/*.cc'",
"glob:'**/*.h'"]
[fix.tools.black]
command = ["/usr/bin/black", "-", "--stdin-filename=$path"]
patterns = ["glob:'**/*.py'"]
Execution order of tools that affect the same file is deterministic, but currently unspecified, and may change between releases. If two tools affect the same file, the second tool to run will receive its input from the output of the first tool.
There is also a deprecated configuration schema that defines a single command that will affect all changed files in the specified revisions. For example, the following configuration would apply the Rust formatter to all changed files (whether they are Rust files or not):
[fix]
tool-command = ["rustfmt", "--emit", "stdout"]
The tool defined by tool-command
acts as if it was the first entry in
fix.tools
, and uses pattern = "all()"``. Support for
tool-command`
will be removed in a future version.
Usage: jj fix [OPTIONS] [PATHS]...
Arguments:¶
<PATHS>
— Fix only these paths
Options:¶
-s
,--source <SOURCE>
— Fix files in the specified revision(s) and their descendants. If no revisions are specified, this defaults to therevsets.fix
setting, orreachable(@, mutable())
if it is not set--include-unchanged-files
— Fix unchanged files in addition to changed ones. If no paths are specified, all files in the repo will be fixed
jj git
¶
Commands for working with Git remotes and the underlying Git repo
For a comparison with Git, including a table of commands, see https://martinvonz.github.io/jj/latest/git-comparison/.
Usage: jj git <COMMAND>
Subcommands:¶
clone
— Create a new repo backed by a clone of a Git repoexport
— Update the underlying Git repo with changes made in the repofetch
— Fetch from a Git remoteimport
— Update repo with changes made in the underlying Git repoinit
— Create a new Git backed repopush
— Push to a Git remoteremote
— Manage Git remotes
jj git clone
¶
Create a new repo backed by a clone of a Git repo
The Git repo will be a bare git repo stored inside the .jj/
directory.
Usage: jj git clone [OPTIONS] <SOURCE> [DESTINATION]
Arguments:¶
<SOURCE>
— URL or path of the Git repo to clone<DESTINATION>
— Specifies the target directory for the Jujutsu repository clone. If not provided, defaults to a directory named after the last component of the source URL. The full directory path will be created if it doesn't exist
Options:¶
-
--remote <REMOTE_NAME>
— Name of the newly created remoteDefault value:
origin
-
--colocate
— Whether or not to colocate the Jujutsu repo with the git repo --depth <DEPTH>
— Create a shallow clone of the given depth
jj git export
¶
Update the underlying Git repo with changes made in the repo
Usage: jj git export
jj git fetch
¶
Fetch from a Git remote
If a working-copy commit gets abandoned, it will be given a new, empty commit. This is true in general; it is not specific to this command.
Usage: jj git fetch [OPTIONS]
Options:¶
-
-b
,--branch <BRANCH>
— Fetch only some of the branchesBy default, the specified name matches exactly. Use
glob:
prefix to expand*
as a glob, e.g.--branch 'glob:push-*'
. Other wildcard characters such as?
are not supported.Default value:
glob:*
-
--remote <REMOTE>
— The remote to fetch from (only named remotes are supported, can be repeated)This defaults to the
git.fetch
setting. If that is not configured, and if there are multiple remotes, the remote named "origin" will be used. -
--all-remotes
— Fetch from all remotes
jj git import
¶
Update repo with changes made in the underlying Git repo
If a working-copy commit gets abandoned, it will be given a new, empty commit. This is true in general; it is not specific to this command.
Usage: jj git import
jj git init
¶
Create a new Git backed repo
Usage: jj git init [OPTIONS] [DESTINATION]
Arguments:¶
-
<DESTINATION>
— The destination directory where thejj
repo will be created. If the directory does not exist, it will be created. If no directory is given, the current directory is used.By default the
git
repo is under$destination/.jj
Default value:
.
Options:¶
-
--colocate
— Specifies that thejj
repo should also be a validgit
repo, allowing the use of bothjj
andgit
commands in the same directory.This is done by placing the backing git repo into a
.git
directory in the root of thejj
repo along with the.jj
directory. If the.git
directory already exists, all the existing commits will be imported.This option is mutually exclusive with
--git-repo
. -
--git-repo <GIT_REPO>
— Specifies a path to an existing git repository to be used as the backing git repo for the newly createdjj
repo.If the specified
--git-repo
path happens to be the same as thejj
repo path (both .jj and .git directories are in the same working directory), then bothjj
andgit
commands will work on the same repo. This is called a co-located repo.This option is mutually exclusive with
--colocate
.
jj git push
¶
Push to a Git remote
By default, pushes tracking bookmarks pointing to remote_bookmarks(remote=<remote>)..@
. Use --bookmark
to push specific bookmarks. Use --all
to push all bookmarks. Use --change
to generate bookmark names based on the change IDs of specific commits.
Before the command actually moves, creates, or deletes a remote bookmark, it makes several safety checks. If there is a problem, you may need to run jj git fetch --remote <remote name>
and/or resolve some bookmark conflicts.
Usage: jj git push [OPTIONS]
Options:¶
-
--remote <REMOTE>
— The remote to push to (only named remotes are supported)This defaults to the
git.push
setting. If that is not configured, and if there are multiple remotes, the remote named "origin" will be used. Unlike in Git, the default remote is not derived from the tracked remote bookmarks. -
-b
,--bookmark <BOOKMARK>
— Push only this bookmark, or bookmarks matching a pattern (can be repeated)By default, the specified name matches exactly. Use
glob:
prefix to select bookmarks by wildcard pattern. For details, see https://martinvonz.github.io/jj/latest/revsets#string-patterns. -
--all
— Push all bookmarks (including new and deleted bookmarks) -
--tracked
— Push all tracked bookmarks (including deleted bookmarks)This usually means that the bookmark was already pushed to or fetched from the relevant remote. For details, see https://martinvonz.github.io/jj/latest/bookmarks#remotes-and-tracked-bookmarks
-
--deleted
— Push all deleted bookmarksOnly tracked bookmarks can be successfully deleted on the remote. A warning will be printed if any untracked bookmarks on the remote correspond to missing local bookmarks.
-
-N
,--allow-new
— Allow pushing new bookmarksNewly-created remote bookmarks will be tracked automatically.
-
--allow-empty-description
— Allow pushing commits with empty descriptions --allow-private
— Allow pushing commits that are private-r
,--revisions <REVISIONS>
— Push bookmarks pointing to these commits (can be repeated)-
-c
,--change <CHANGE>
— Push this commit by creating a bookmark based on its change ID (can be repeated)The created bookmark will be tracked automatically. Use the
git.push-bookmark-prefix
setting to change the prefix for generated names. -
--dry-run
— Only display what will change on the remote
jj git remote
¶
Manage Git remotes
The Git repo will be a bare git repo stored inside the .jj/
directory.
Usage: jj git remote <COMMAND>
Subcommands:¶
add
— Add a Git remotelist
— List Git remotesremove
— Remove a Git remote and forget its bookmarksrename
— Rename a Git remoteset-url
— Set the URL of a Git remote
jj git remote add
¶
Add a Git remote
Usage: jj git remote add <REMOTE> <URL>
Arguments:¶
<REMOTE>
— The remote's name<URL>
— The remote's URL
jj git remote list
¶
List Git remotes
Usage: jj git remote list
jj git remote remove
¶
Remove a Git remote and forget its bookmarks
Usage: jj git remote remove <REMOTE>
Arguments:¶
<REMOTE>
— The remote's name
jj git remote rename
¶
Rename a Git remote
Usage: jj git remote rename <OLD> <NEW>
Arguments:¶
<OLD>
— The name of an existing remote<NEW>
— The desired name forold
jj git remote set-url
¶
Set the URL of a Git remote
Usage: jj git remote set-url <REMOTE> <URL>
Arguments:¶
<REMOTE>
— The remote's name<URL>
— The desired url forremote
jj help
¶
Print this message or the help of the given subcommand(s)
Usage: jj help [OPTIONS] [COMMAND]...
Arguments:¶
<COMMAND>
— Print help for the subcommand(s)
Options:¶
-
-k
,--keyword <KEYWORD>
— Show help for keywords instead of commandsPossible values:
bookmarks
: Named pointers to revisions (similar to Git's branches)config
: How and where to set configuration optionsfilesets
: A functional language for selecting a set of filesglossary
: Definitions of various termsrevsets
: A functional language for selecting a set of revisiontemplates
: A functional language to customize command outputtutorial
: Show a tutorial to get started with jj
jj init
¶
Create a new repo in the given directory
If the given directory does not exist, it will be created. If no directory is given, the current directory is used.
Usage: jj init [DESTINATION]
Arguments:¶
-
<DESTINATION>
— The destination directoryDefault value:
.
jj interdiff
¶
Compare the changes of two commits
This excludes changes from other commits by temporarily rebasing --from
onto --to
's parents. If you wish to compare the same change across versions, consider jj evolog -p
instead.
Usage: jj interdiff [OPTIONS] <--from <FROM>|--to <TO>> [PATHS]...
Arguments:¶
<PATHS>
— Restrict the diff to these paths
Options:¶
-f
,--from <FROM>
— Show changes from this revision-t
,--to <TO>
— Show changes to this revision-s
,--summary
— For each path, show only whether it was modified, added, or deleted--stat
— Show a histogram of the changes-
--types
— For each path, show only its type before and afterThe diff is shown as two letters. The first letter indicates the type before and the second letter indicates the type after. '-' indicates that the path was not present, 'F' represents a regular file, `L' represents a symlink, 'C' represents a conflict, and 'G' represents a Git submodule.
-
--name-only
— For each path, show only its pathTypically useful for shell commands like:
jj diff -r @- --name_only | xargs perl -pi -e's/OLD/NEW/g
-
--git
— Show a Git-format diff --color-words
— Show a word-level diff with changes indicated only by color--tool <TOOL>
— Generate diff by external command--context <CONTEXT>
— Number of lines of context to show-w
,--ignore-all-space
— Ignore whitespace when comparing lines-b
,--ignore-space-change
— Ignore changes in amount of whitespace when comparing lines
jj log
¶
Show revision history
Renders a graphical view of the project's history, ordered with children before parents. By default, the output only includes mutable revisions, along with some additional revisions for context. Use jj log -r ::
to see all revisions. See jj help -k revsets
(or https://martinvonz.github.io/jj/latest/revsets/) for information about the syntax.
Spans of revisions that are not included in the graph per --revisions
are rendered as a synthetic node labeled "(elided revisions)".
The working-copy commit is indicated by a @
symbol in the graph. Immutable revisions (https://martinvonz.github.io/jj/latest/config/#set-of-immutable-commits) have a ◆
symbol. Other commits have a ○
symbol. To customize these symbols, see https://martinvonz.github.io/jj/latest/config/#node-style.
Usage: jj log [OPTIONS] [PATHS]...
Arguments:¶
<PATHS>
— Show revisions modifying the given paths
Options:¶
-
-r
,--revisions <REVISIONS>
— Which revisions to showIf no paths nor revisions are specified, this defaults to the
revsets.log
setting. -
--reversed
— Show revisions in the opposite order (older revisions first) -
-n
,--limit <LIMIT>
— Limit number of revisions to showApplied after revisions are filtered and reordered.
-
--no-graph
— Don't show the graph, show a flat list of revisions -
-T
,--template <TEMPLATE>
— Render each revision using the given templateRun
jj log -T
to list the built-in templates.You can also specify arbitrary template expressions. For the syntax, see https://martinvonz.github.io/jj/latest/templates/.
If not specified, this defaults to the
templates.log
setting. -
-p
,--patch
— Show patch -s
,--summary
— For each path, show only whether it was modified, added, or deleted--stat
— Show a histogram of the changes-
--types
— For each path, show only its type before and afterThe diff is shown as two letters. The first letter indicates the type before and the second letter indicates the type after. '-' indicates that the path was not present, 'F' represents a regular file, `L' represents a symlink, 'C' represents a conflict, and 'G' represents a Git submodule.
-
--name-only
— For each path, show only its pathTypically useful for shell commands like:
jj diff -r @- --name_only | xargs perl -pi -e's/OLD/NEW/g
-
--git
— Show a Git-format diff --color-words
— Show a word-level diff with changes indicated only by color--tool <TOOL>
— Generate diff by external command--context <CONTEXT>
— Number of lines of context to show--ignore-all-space
— Ignore whitespace when comparing lines--ignore-space-change
— Ignore changes in amount of whitespace when comparing lines
jj new
¶
Create a new, empty change and (by default) edit it in the working copy
By default, jj
will edit the new change, making the working copy represent the new commit. This can be avoided with --no-edit
.
Note that you can create a merge commit by specifying multiple revisions as argument. For example, jj new @ main
will create a new commit with the working copy and the main
bookmark as parents.
For more information, see https://martinvonz.github.io/jj/latest/working-copy/.
Usage: jj new [OPTIONS] [REVISIONS]...
Arguments:¶
-
<REVISIONS>
— Parent(s) of the new changeDefault value:
@
Options:¶
-m
,--message <MESSAGE>
— The change description to use--no-edit
— Do not edit the newly created change-A
,--insert-after <INSERT_AFTER>
— Insert the new change after the given commit(s)-B
,--insert-before <INSERT_BEFORE>
— Insert the new change before the given commit(s)
jj next
¶
Move the working-copy commit to the child revision
The command creates a new empty working copy revision that is the child of a
descendant offset
revisions ahead of the parent of the current working
copy.
For example, when the offset is 1:
D D @
| |/
C @ => C
|/ |
B B
If --edit
is passed, the working copy revision is changed to the child of
the current working copy revision.
D D
| |
C C
| |
B => @
| |
@ A
Usage: jj next [OPTIONS] [OFFSET]
Arguments:¶
-
<OFFSET>
— How many revisions to move forward. Advances to the next child by defaultDefault value:
1
Options:¶
-
-e
,--edit
— Instead of creating a new working-copy commit on top of the target commit (likejj new
), edit the target commit directly (likejj edit
)Takes precedence over config in
ui.movement.edit
; i.e. will negateui.movement.edit = false
-
-n
,--no-edit
— The inverse of--edit
Takes precedence over config in
ui.movement.edit
; i.e. will negateui.movement.edit = true
-
--conflict
— Jump to the next conflicted descendant
jj operation
¶
Commands for working with the operation log
For information about the operation log, see https://martinvonz.github.io/jj/latest/operation-log/.
Usage: jj operation <COMMAND>
Subcommands:¶
abandon
— Abandon operation historydiff
— Compare changes to the repository between two operationslog
— Show the operation logrestore
— Create a new operation that restores the repo to an earlier stateshow
— Show changes to the repository in an operationundo
— Create a new operation that undoes an earlier operation
jj operation abandon
¶
Abandon operation history
To discard old operation history, use jj op abandon ..<operation ID>
. It will abandon the specified operation and all its ancestors. The descendants will be reparented onto the root operation.
To discard recent operations, use jj op restore <operation ID>
followed by jj op abandon <operation ID>..@-
.
The abandoned operations, commits, and other unreachable objects can later be garbage collected by using jj util gc
command.
Usage: jj operation abandon <OPERATION>
Arguments:¶
<OPERATION>
— The operation or operation range to abandon
jj operation diff
¶
Compare changes to the repository between two operations
Usage: jj operation diff [OPTIONS]
Options:¶
--operation <OPERATION>
— Show repository changes in this operation, compared to its parent-f
,--from <FROM>
— Show repository changes from this operation-t
,--to <TO>
— Show repository changes to this operation--no-graph
— Don't show the graph, show a flat list of modified changes-
-p
,--patch
— Show patch of modifications to changesIf the previous version has different parents, it will be temporarily rebased to the parents of the new version, so the diff is not contaminated by unrelated changes.
-
-s
,--summary
— For each path, show only whether it was modified, added, or deleted --stat
— Show a histogram of the changes-
--types
— For each path, show only its type before and afterThe diff is shown as two letters. The first letter indicates the type before and the second letter indicates the type after. '-' indicates that the path was not present, 'F' represents a regular file, `L' represents a symlink, 'C' represents a conflict, and 'G' represents a Git submodule.
-
--name-only
— For each path, show only its pathTypically useful for shell commands like:
jj diff -r @- --name_only | xargs perl -pi -e's/OLD/NEW/g
-
--git
— Show a Git-format diff --color-words
— Show a word-level diff with changes indicated only by color--tool <TOOL>
— Generate diff by external command--context <CONTEXT>
— Number of lines of context to show--ignore-all-space
— Ignore whitespace when comparing lines--ignore-space-change
— Ignore changes in amount of whitespace when comparing lines
jj operation log
¶
Show the operation log
Like other commands, jj op log
snapshots the current working-copy changes and reconciles divergent operations. Use --at-op=@ --ignore-working-copy
to inspect the current state without mutation.
Usage: jj operation log [OPTIONS]
Options:¶
-n
,--limit <LIMIT>
— Limit number of operations to show--no-graph
— Don't show the graph, show a flat list of operations-
-T
,--template <TEMPLATE>
— Render each operation using the given templateFor the syntax, see https://martinvonz.github.io/jj/latest/templates/
-
--op-diff
— Show changes to the repository at each operation -
-p
,--patch
— Show patch of modifications to changes (implies --op-diff)If the previous version has different parents, it will be temporarily rebased to the parents of the new version, so the diff is not contaminated by unrelated changes.
-
-s
,--summary
— For each path, show only whether it was modified, added, or deleted --stat
— Show a histogram of the changes-
--types
— For each path, show only its type before and afterThe diff is shown as two letters. The first letter indicates the type before and the second letter indicates the type after. '-' indicates that the path was not present, 'F' represents a regular file, `L' represents a symlink, 'C' represents a conflict, and 'G' represents a Git submodule.
-
--name-only
— For each path, show only its pathTypically useful for shell commands like:
jj diff -r @- --name_only | xargs perl -pi -e's/OLD/NEW/g
-
--git
— Show a Git-format diff --color-words
— Show a word-level diff with changes indicated only by color--tool <TOOL>
— Generate diff by external command--context <CONTEXT>
— Number of lines of context to show--ignore-all-space
— Ignore whitespace when comparing lines--ignore-space-change
— Ignore changes in amount of whitespace when comparing lines
jj operation restore
¶
Create a new operation that restores the repo to an earlier state
This restores the repo to the state at the specified operation, effectively undoing all later operations. It does so by creating a new operation.
Usage: jj operation restore [OPTIONS] <OPERATION>
Arguments:¶
-
<OPERATION>
— The operation to restore toUse
jj op log
to find an operation to restore to. Use e.g.jj --at-op=<operation ID> log
before restoring to an operation to see the state of the repo at that operation.
Options:¶
-
--what <WHAT>
— What portions of the local state to restore (can be repeated)This option is EXPERIMENTAL.
Default values:
repo
,remote-tracking
Possible values:
repo
: The jj repo state and local bookmarksremote-tracking
: The remote-tracking bookmarks. Do not restore these if you'd like to push after the undo
jj operation show
¶
Show changes to the repository in an operation
Usage: jj operation show [OPTIONS] [OPERATION]
Arguments:¶
-
<OPERATION>
— Show repository changes in this operation, compared to its parent(s)Default value:
@
Options:¶
--no-graph
— Don't show the graph, show a flat list of modified changes-
-p
,--patch
— Show patch of modifications to changesIf the previous version has different parents, it will be temporarily rebased to the parents of the new version, so the diff is not contaminated by unrelated changes.
-
-s
,--summary
— For each path, show only whether it was modified, added, or deleted --stat
— Show a histogram of the changes-
--types
— For each path, show only its type before and afterThe diff is shown as two letters. The first letter indicates the type before and the second letter indicates the type after. '-' indicates that the path was not present, 'F' represents a regular file, `L' represents a symlink, 'C' represents a conflict, and 'G' represents a Git submodule.
-
--name-only
— For each path, show only its pathTypically useful for shell commands like:
jj diff -r @- --name_only | xargs perl -pi -e's/OLD/NEW/g
-
--git
— Show a Git-format diff --color-words
— Show a word-level diff with changes indicated only by color--tool <TOOL>
— Generate diff by external command--context <CONTEXT>
— Number of lines of context to show--ignore-all-space
— Ignore whitespace when comparing lines--ignore-space-change
— Ignore changes in amount of whitespace when comparing lines
jj operation undo
¶
Create a new operation that undoes an earlier operation
This undoes an individual operation by applying the inverse of the operation.
Usage: jj operation undo [OPTIONS] [OPERATION]
Arguments:¶
-
<OPERATION>
— The operation to undoUse
jj op log
to find an operation to undo.Default value:
@
Options:¶
-
--what <WHAT>
— What portions of the local state to restore (can be repeated)This option is EXPERIMENTAL.
Default values:
repo
,remote-tracking
Possible values:
repo
: The jj repo state and local bookmarksremote-tracking
: The remote-tracking bookmarks. Do not restore these if you'd like to push after the undo
jj parallelize
¶
Parallelize revisions by making them siblings
Running jj parallelize 1::2
will transform the history like this:
3
| 3
2 / \
| -> 1 2
1 \ /
| 0
0
The command effectively says "these revisions are actually independent", meaning that they should no longer be ancestors/descendants of each other. However, revisions outside the set that were previously ancestors of a revision in the set will remain ancestors of it. For example, revision 0 above remains an ancestor of both 1 and 2. Similarly, revisions outside the set that were previously descendants of a revision in the set will remain descendants of it. For example, revision 3 above remains a descendant of both 1 and 2.
Therefore, jj parallelize '1 | 3'
is a no-op. That's because 2, which is
not in the target set, was a descendant of 1 before, so it remains a
descendant, and it was an ancestor of 3 before, so it remains an ancestor.
Usage: jj parallelize [REVISIONS]...
Arguments:¶
<REVISIONS>
— Revisions to parallelize
jj prev
¶
Change the working copy revision relative to the parent revision
The command creates a new empty working copy revision that is the child of
an ancestor offset
revisions behind the parent of the current working
copy.
For example, when the offset is 1:
D @ D
|/ |
A => A @
| |/
B B
If --edit
is passed, the working copy revision is changed to the parent of
the current working copy revision.
D @ D
|/ |
C => @
| |
B B
| |
A A
Usage: jj prev [OPTIONS] [OFFSET]
Arguments:¶
-
<OFFSET>
— How many revisions to move backward. Moves to the parent by defaultDefault value:
1
Options:¶
-
-e
,--edit
— Edit the parent directly, instead of moving the working-copy commitTakes precedence over config in
ui.movement.edit
; i.e. will negateui.movement.edit = false
-
-n
,--no-edit
— The inverse of--edit
Takes precedence over config in
ui.movement.edit
; i.e. will negateui.movement.edit = true
-
--conflict
— Jump to the previous conflicted ancestor
jj rebase
¶
Move revisions to different parent(s)
There are three different ways of specifying which revisions to rebase:
-b
to rebase a whole branch, -s
to rebase a revision and its
descendants, and -r
to rebase a single commit. If none of them is
specified, it defaults to -b @
.
With -s
, the command rebases the specified revision and its descendants
onto the destination. For example, jj rebase -s M -d O
would transform
your history like this (letters followed by an apostrophe are post-rebase
versions):
O N'
| |
| N M'
| | |
| M O
| | => |
| | L | L
| |/ | |
| K | K
|/ |/
J J
With -b
, the command rebases the whole "branch" containing the specified
revision. A "branch" is the set of commits that includes:
- the specified revision and ancestors that are not also ancestors of the destination
- all descendants of those commits
In other words, jj rebase -b X -d Y
rebases commits in the revset
(Y..X)::
(which is equivalent to jj rebase -s 'roots(Y..X)' -d Y
for a
single root). For example, either jj rebase -b L -d O
or jj rebase -b M
-d O
would transform your history like this (because L
and M
are on the
same "branch", relative to the destination):
O N'
| |
| N M'
| | |
| M | L'
| | => |/
| | L K'
| |/ |
| K O
|/ |
J J
With -r
, the command rebases only the specified revisions onto the
destination. Any "hole" left behind will be filled by rebasing descendants
onto the specified revision's parent(s). For example, jj rebase -r K -d M
would transform your history like this:
M K'
| |
| L M
| | => |
| K | L'
|/ |/
J J
Note that you can create a merge commit by repeating the -d
argument.
For example, if you realize that commit L actually depends on commit M in
order to work (in addition to its current parent K), you can run jj rebase
-s L -d K -d M
:
M L'
| |\
| L M |
| | => | |
| K | K
|/ |/
J J
If a working-copy commit gets abandoned, it will be given a new, empty commit. This is true in general; it is not specific to this command.
Usage: jj rebase [OPTIONS] <--destination <DESTINATION>|--insert-after <INSERT_AFTER>|--insert-before <INSERT_BEFORE>>
Options:¶
-
-b
,--branch <BRANCH>
— Rebase the whole branch relative to destination's ancestors (can be repeated)jj rebase -b=br -d=dst
is equivalent tojj rebase '-s=roots(dst..br)' -d=dst
.If none of
-b
,-s
, or-r
is provided, then the default is-b @
. -
-s
,--source <SOURCE>
— Rebase specified revision(s) together with their trees of descendants (can be repeated)Each specified revision will become a direct child of the destination revision(s), even if some of the source revisions are descendants of others.
If none of
-b
,-s
, or-r
is provided, then the default is-b @
. -
-r
,--revisions <REVISIONS>
— Rebase the given revisions, rebasing descendants onto this revision's parent(s)Unlike
-s
or-b
, you mayjj rebase -r
a revisionA
onto a descendant ofA
.If none of
-b
,-s
, or-r
is provided, then the default is-b @
. -
-d
,--destination <DESTINATION>
— The revision(s) to rebase onto (can be repeated to create a merge commit) -A
,--insert-after <INSERT_AFTER>
— The revision(s) to insert after (can be repeated to create a merge commit)-B
,--insert-before <INSERT_BEFORE>
— The revision(s) to insert before (can be repeated to create a merge commit)--skip-emptied
— If true, when rebasing would produce an empty commit, the commit is abandoned. It will not be abandoned if it was already empty before the rebase. Will never skip merge commits with multiple non-empty parents
jj resolve
¶
Resolve a conflicted file with an external merge tool
Only conflicts that can be resolved with a 3-way merge are supported. See docs for merge tool configuration instructions.
Note that conflicts can also be resolved without using this command. You may edit the conflict markers in the conflicted file directly with a text editor.
Usage: jj resolve [OPTIONS] [PATHS]...
Arguments:¶
<PATHS>
— Restrict to these paths when searching for a conflict to resolve. We will attempt to resolve the first conflict we can find. You can use the--list
argument to find paths to use here
Options:¶
-
-r
,--revision <REVISION>
Default value:
@
-
-l
,--list
— Instead of resolving one conflict, list all the conflicts --tool <NAME>
— Specify 3-way merge tool to be used
jj restore
¶
Restore paths from another revision
That means that the paths get the same content in the destination (--to
) as they had in the source (--from
). This is typically used for undoing changes to some paths in the working copy (jj restore <paths>
).
If only one of --from
or --to
is specified, the other one defaults to the working copy.
When neither --from
nor --to
is specified, the command restores into the working copy from its parent(s). jj restore
without arguments is similar to jj abandon
, except that it leaves an empty revision with its description and other metadata preserved.
See jj diffedit
if you'd like to restore portions of files rather than entire files.
Usage: jj restore [OPTIONS] [PATHS]...
Arguments:¶
<PATHS>
— Restore only these paths (instead of all paths)
Options:¶
-f
,--from <FROM>
— Revision to restore from (source)-t
,--to <TO>
— Revision to restore into (destination)-
-c
,--changes-in <REVISION>
— Undo the changes in a revision as compared to the merge of its parents.This undoes the changes that can be seen with
jj diff -r REVISION
. IfREVISION
only has a single parent, this option is equivalent tojj restore --to REVISION --from REVISION-
.The default behavior of
jj restore
is equivalent tojj restore --changes-in @
. -
--restore-descendants
— Preserve the content (not the diff) when rebasing descendants
jj root
¶
Show the current workspace root directory
Usage: jj root
jj show
¶
Show commit description and changes in a revision
Usage: jj show [OPTIONS] [REVISION]
Arguments:¶
-
<REVISION>
— Show changes in this revision, compared to its parent(s)Default value:
@
Options:¶
-
-T
,--template <TEMPLATE>
— Render a revision using the given templateFor the syntax, see https://martinvonz.github.io/jj/latest/templates/
-
-s
,--summary
— For each path, show only whether it was modified, added, or deleted --stat
— Show a histogram of the changes-
--types
— For each path, show only its type before and afterThe diff is shown as two letters. The first letter indicates the type before and the second letter indicates the type after. '-' indicates that the path was not present, 'F' represents a regular file, `L' represents a symlink, 'C' represents a conflict, and 'G' represents a Git submodule.
-
--name-only
— For each path, show only its pathTypically useful for shell commands like:
jj diff -r @- --name_only | xargs perl -pi -e's/OLD/NEW/g
-
--git
— Show a Git-format diff --color-words
— Show a word-level diff with changes indicated only by color--tool <TOOL>
— Generate diff by external command--context <CONTEXT>
— Number of lines of context to show--ignore-all-space
— Ignore whitespace when comparing lines--ignore-space-change
— Ignore changes in amount of whitespace when comparing lines
jj simplify-parents
¶
Simplify parent edges for the specified revision(s).
Removes all parents of each of the specified revisions that are also indirect ancestors of the same revisions through other parents. This has no effect on any revision's contents, including the working copy.
In other words, for all (A, B, C) where A has (B, C) as parents and C is an ancestor of B, A will be rewritten to have only B as a parent instead of B+C.
Usage: jj simplify-parents [OPTIONS]
Options:¶
-s
,--source <SOURCE>
— Simplify specified revision(s) together with their trees of descendants (can be repeated)-
-r
,--revisions <REVISIONS>
— Simplify specified revision(s) (can be repeated)If both
--source
and--revisions
are not provided, this defaults to therevsets.simplify-parents
setting, orreachable(@, mutable())
if it is not set.
jj sparse
¶
Manage which paths from the working-copy commit are present in the working copy
Usage: jj sparse <COMMAND>
Subcommands:¶
edit
— Start an editor to update the patterns that are present in the working copylist
— List the patterns that are currently present in the working copyreset
— Reset the patterns to include all files in the working copyset
— Update the patterns that are present in the working copy
jj sparse edit
¶
Start an editor to update the patterns that are present in the working copy
Usage: jj sparse edit
jj sparse list
¶
List the patterns that are currently present in the working copy
By default, a newly cloned or initialized repo will have have a pattern matching all files from the repo root. That pattern is rendered as .
(a single period).
Usage: jj sparse list
jj sparse reset
¶
Reset the patterns to include all files in the working copy
Usage: jj sparse reset
jj sparse set
¶
Update the patterns that are present in the working copy
For example, if all you need is the README.md
and the lib/
directory, use jj sparse set --clear --add README.md --add lib
. If you no longer need the lib
directory, use jj sparse set --remove lib
.
Usage: jj sparse set [OPTIONS]
Options:¶
--add <ADD>
— Patterns to add to the working copy--remove <REMOVE>
— Patterns to remove from the working copy--clear
— Include no files in the working copy (combine with --add)
jj split
¶
Split a revision in two
Starts a diff editor on the changes in the revision. Edit the right side of the diff until it has the content you want in the first revision. Once you close the editor, your edited content will replace the previous revision. The remaining changes will be put in a new revision on top.
If the change you split had a description, you will be asked to enter a change description for each commit. If the change did not have a description, the second part will not get a description, and you will be asked for a description only for the first part.
Splitting an empty commit is not supported because the same effect can be achieved with jj new
.
Usage: jj split [OPTIONS] [FILESETS]...
Arguments:¶
<FILESETS>
— Files matching any of these filesets are put in the first commit
Options:¶
-
-i
,--interactive
— Interactively choose which parts to splitThis is the default if no filesets are provided.
-
--tool <NAME>
— Specify diff editor to be used (implies --interactive) -
-r
,--revision <REVISION>
— The revision to splitDefault value:
@
-
-p
,--parallel
— Split the revision into two parallel revisions instead of a parent and child
jj squash
¶
Move changes from a revision into another revision
With the -r
option, moves the changes from the specified revision to the parent revision. Fails if there are several parent revisions (i.e., the given revision is a merge).
With the --from
and/or --into
options, moves changes from/to the given revisions. If either is left out, it defaults to the working-copy commit. For example, jj squash --into @--
moves changes from the working-copy commit to the grandparent.
If, after moving changes out, the source revision is empty compared to its parent(s), and --keep-emptied
is not set, it will be abandoned. Without --interactive
or paths, the source revision will always be empty.
If the source was abandoned and both the source and destination had a non-empty description, you will be asked for the combined description. If either was empty, then the other one will be used.
If a working-copy commit gets abandoned, it will be given a new, empty commit. This is true in general; it is not specific to this command.
Usage: jj squash [OPTIONS] [PATHS]...
Arguments:¶
<PATHS>
— Move only changes to these paths (instead of all paths)
Options:¶
-r
,--revision <REVISION>
— Revision to squash into its parent (default: @)-f
,--from <FROM>
— Revision(s) to squash from (default: @)-t
,--into <INTO>
— Revision to squash into (default: @)-m
,--message <MESSAGE>
— The description to use for squashed revision (don't open editor)-u
,--use-destination-message
— Use the description of the destination revision and discard the description(s) of the source revision(s)-i
,--interactive
— Interactively choose which parts to squash--tool <NAME>
— Specify diff editor to be used (implies --interactive)-k
,--keep-emptied
— The source revision will not be abandoned
jj status
¶
Show high-level repo status
This includes:
- The working copy commit and its (first) parent, and a summary of the changes between them * Conflicted bookmarks (see https://martinvonz.github.io/jj/latest/bookmarks/)
Usage: jj status [PATHS]...
Arguments:¶
<PATHS>
— Restrict the status display to these paths
jj tag
¶
Manage tags
Usage: jj tag <COMMAND>
Subcommands:¶
list
— List tags
jj tag list
¶
List tags
Usage: jj tag list [OPTIONS] [NAMES]...
Arguments:¶
-
<NAMES>
— Show tags whose local name matchesBy default, the specified name matches exactly. Use
glob:
prefix to select tags by wildcard pattern. For details, see https://martinvonz.github.io/jj/latest/revsets/#string-patterns.
Options:¶
-
-T
,--template <TEMPLATE>
— Render each tag using the given templateAll 0-argument methods of the
RefName
type are available as keywords.For the syntax, see https://martinvonz.github.io/jj/latest/templates/
jj util
¶
Infrequently used commands such as for generating shell completions
Usage: jj util <COMMAND>
Subcommands:¶
completion
— Print a command-line-completion scriptconfig-schema
— Print the JSON schema for the jj TOML config formatexec
— Execute an external command via jjgc
— Run backend-dependent garbage collectionmangen
— Print a ROFF (manpage)markdown-help
— Print the CLI help for all subcommands in Markdown
jj util completion
¶
Print a command-line-completion script
Apply it by running one of these:
- Bash:
source <(jj util completion bash)
- Fish:
jj util completion fish | source
- Nushell:
jj util completion nushell | save "completions-jj.nu" use "completions-jj.nu" * # Or `source "completions-jj.nu"`
- Zsh:
autoload -U compinit compinit source <(jj util completion zsh)
Usage: jj util completion [SHELL]
Arguments:¶
-
<SHELL>
Possible values:
bash
,elvish
,fish
,nushell
,power-shell
,zsh
jj util config-schema
¶
Print the JSON schema for the jj TOML config format
Usage: jj util config-schema
jj util exec
¶
Execute an external command via jj
This is useful for arbitrary aliases.
!! WARNING !!
The following technique just provides a convenient syntax for running
arbitrary code on your system. Using it irresponsibly may cause damage
ranging from breaking the behavior of jj undo
to wiping your file system.
Exercise the same amount of caution while writing these aliases as you would
when typing commands into the terminal!
This feature may be removed or replaced by an embedded scripting language in the future.
Let's assume you have a script called "my-jj-script" in you $PATH and you would like to execute it as "jj my-script". You would add the following line to your configuration file to achieve that:
[aliases]
my-script = ["util", "exec", "--", "my-jj-script"]
# ^^^^
# This makes sure that flags are passed to your script instead of parsed by jj.
If you don't want to manage your script as a separate file, you can even inline it into your config file:
[aliases]
my-inline-script = ["util", "exec", "--", "bash", "-c", """
#!/usr/bin/env bash
set -euo pipefail
echo "Look Ma, everything in one file!"
echo "args: $@"
""", ""]
# ^^
# This last empty string will become "$0" in bash, so your actual arguments
# are all included in "$@" and start at "$1" as expected.
Usage: jj util exec <COMMAND> [ARGS]...
Arguments:¶
<COMMAND>
— External command to execute<ARGS>
— Arguments to pass to the external command
jj util gc
¶
Run backend-dependent garbage collection.
To garbage-collect old operations and the commits/objects referenced by then, run jj op abandon ..<some old operation>
before jj util gc
.
Previous versions of a change that are reachable via the evolution log are not garbage-collected.
Usage: jj util gc [OPTIONS]
Options:¶
-
--expire <EXPIRE>
— Time thresholdBy default, only obsolete objects and operations older than 2 weeks are pruned.
Only the string "now" can be passed to this parameter. Support for arbitrary absolute and relative timestamps will come in a subsequent release.
jj util mangen
¶
Print a ROFF (manpage)
Usage: jj util mangen
jj util markdown-help
¶
Print the CLI help for all subcommands in Markdown
Usage: jj util markdown-help
jj undo
¶
Undo an operation (shortcut for jj op undo
)
Usage: jj undo [OPTIONS] [OPERATION]
Arguments:¶
-
<OPERATION>
— The operation to undoUse
jj op log
to find an operation to undo.Default value:
@
Options:¶
-
--what <WHAT>
— What portions of the local state to restore (can be repeated)This option is EXPERIMENTAL.
Default values:
repo
,remote-tracking
Possible values:
repo
: The jj repo state and local bookmarksremote-tracking
: The remote-tracking bookmarks. Do not restore these if you'd like to push after the undo
jj version
¶
Display version information
Usage: jj version
jj workspace
¶
Commands for working with workspaces
Workspaces let you add additional working copies attached to the same repo. A common use case is so you can run a slow build or test in one workspace while you're continuing to write code in another workspace.
Each workspace has its own working-copy commit. When you have more than one workspace attached to a repo, they are indicated by <workspace name>@
in jj log
.
Each workspace also has own sparse patterns.
Usage: jj workspace <COMMAND>
Subcommands:¶
add
— Add a workspaceforget
— Stop tracking a workspace's working-copy commit in the repolist
— List workspacesrename
— Renames the current workspaceroot
— Show the current workspace root directoryupdate-stale
— Update a workspace that has become stale
jj workspace add
¶
Add a workspace
By default, the new workspace inherits the sparse patterns of the current workspace. You can override this with the --sparse-patterns
option.
Usage: jj workspace add [OPTIONS] <DESTINATION>
Arguments:¶
<DESTINATION>
— Where to create the new workspace
Options:¶
-
--name <NAME>
— A name for the workspaceTo override the default, which is the basename of the destination directory.
-
-r
,--revision <REVISION>
— A list of parent revisions for the working-copy commit of the newly created workspace. You may specify nothing, or any number of parents.If no revisions are specified, the new workspace will be created, and its working-copy commit will exist on top of the parent(s) of the working-copy commit in the current workspace, i.e. they will share the same parent(s).
If any revisions are specified, the new workspace will be created, and the new working-copy commit will be created with all these revisions as parents, i.e. the working-copy commit will exist as if you had run
jj new r1 r2 r3 ...
. -
--sparse-patterns <SPARSE_PATTERNS>
— How to handle sparse patterns when creating a new workspaceDefault value:
copy
Possible values:
copy
: Copy all sparse patterns from the current workspacefull
: Include all files in the new workspaceempty
: Clear all files from the workspace (it will be empty)
jj workspace forget
¶
Stop tracking a workspace's working-copy commit in the repo
The workspace will not be touched on disk. It can be deleted from disk before or after running this command.
Usage: jj workspace forget [WORKSPACES]...
Arguments:¶
<WORKSPACES>
— Names of the workspaces to forget. By default, forgets only the current workspace
jj workspace list
¶
List workspaces
Usage: jj workspace list
jj workspace rename
¶
Renames the current workspace
Usage: jj workspace rename <NEW_WORKSPACE_NAME>
Arguments:¶
<NEW_WORKSPACE_NAME>
— The name of the workspace to update to
jj workspace root
¶
Show the current workspace root directory
Usage: jj workspace root
jj workspace update-stale
¶
Update a workspace that has become stale
For information about stale working copies, see https://martinvonz.github.io/jj/latest/working-copy/.
Usage: jj workspace update-stale
This document was generated automatically by
clap-markdown
.