LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

jj-split

divides a change into multiple changes

TLDR

Split the working-copy change interactively
$ jj split
copy
Split a specific revision
$ jj split -r [rev]
copy
Move specific files into the first change
$ jj split [file1] [file2]
copy
Split with a description for the selected part
$ jj split -m "[message]" [path/to/file]
copy
Split into two sibling changes instead of parent and child
$ jj split -p [file]
copy
Extract selected changes into a new commit on top of another revision
$ jj split -o [destination] [file]
copy
Force interactive hunk selection even with filesets
$ jj split -i [path/to/dir]
copy

SYNOPSIS

jj split [options] [filesets...]

DESCRIPTION

jj split divides a revision into two. A diff editor opens on the changes in the revision; edit the right side until it contains what should go into the first commit. After closing the editor, the selected changes stay in the original commit and the remaining changes move into a new child commit, with descendants rebased on top.With -p the two parts become siblings on the same parent. With -o, -A or -B the selected changes are extracted to a new commit at a different location, which is a quick way to move part of a change elsewhere in the history.

PARAMETERS

FILESETS

Files matching any of these go into the selected (first) change.
-r, --revision REV
Revision to split (default: @).
-i, --interactive
Interactively choose which parts to split. Default when no filesets are given.
--tool NAME
Diff editor to use (implies --interactive).
-m, --message MESSAGE
Description for the selected changes, without opening an editor.
--editor
Open an editor for the description even when --message is given.
-p, --parallel
Make the two parts siblings instead of parent and child.
-o, --onto REVSETS
Put the selected changes into a new commit on the given revision(s); the rest stays in place.
-A, --insert-after REVSETS
Insert the selected changes as a new commit after the given revision(s).
-B, --insert-before REVSETS
Insert the selected changes as a new commit before the given revision(s).

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

Splitting an empty commit is not supported; use jj new instead. You are prompted for descriptions of the split commits unless -m is used.

SEE ALSO

RESOURCES

Copied to clipboard
Kai