LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

jj-sparse

manages which paths from a Jujutsu working-copy commit are present on disk

TLDR

List the patterns currently present in the working copy
$ jj sparse list
copy
Edit the patterns in an editor
$ jj sparse edit
copy
Reset the patterns so every file is present
$ jj sparse reset
copy
Keep only selected paths (clear first, then add)
$ jj sparse set --clear --add [path/to/directory]
copy
Add a path without dropping the rest
$ jj sparse set --add [path/to/directory]
copy
Add several paths
$ jj sparse set --add [path/to/dir1] --add [path/to/dir2]
copy
Remove a path from the working copy
$ jj sparse set --remove [path/to/directory]
copy
Materialize nothing (empty working copy)
$ jj sparse set --clear
copy

SYNOPSIS

jj sparse (list | edit | reset | set [options])

DESCRIPTION

jj sparse controls which paths from the working-copy commit are written to the working copy on disk. The commit itself still holds the full tree; only the checked-out files change. That is the Jujutsu counterpart of Git sparse checkout, implemented natively rather than through Git's sparse-checkout machinery.Typical use is a large repo where you only need a subdirectory: `jj sparse set --clear --add lib` leaves `lib/` (and whatever else you add) on disk and omits the rest. `jj sparse list` shows the current patterns; `jj sparse reset` puts every file back.

PARAMETERS

--add PATTERN

Include this path (or other pattern) in the working copy. Repeatable.
--remove PATTERN
Drop this path from the working copy. Repeatable.
--clear
Start from an empty set (no files present). Usually combined with --add.

SUBCOMMANDS

list

Print the patterns that are currently present in the working copy. A newly cloned or initialized repo has a single pattern matching everything from the repo root, rendered as ..
edit
Open an editor on the pattern list so you can add or drop paths by hand.
reset
Restore the default pattern set that includes all files in the working copy.
set
Update the pattern set from flags. Combine --clear with --add to replace the list, or use --add / --remove to change it in place.

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. Patterns apply to the current workspace's working copy, not to other workspaces of the same repo. Git's own sparse-checkout is not used and is listed as unsupported in Jujutsu's Git-compatibility notes.

SEE ALSO

RESOURCES

Copied to clipboard
Kai