plain `init`
decreased in utility.
'check-rules'::
Check whether sparsity rules match one or more paths.
+
By default `check-rules` reads a list of paths from stdin and outputs only
the ones that match the current sparsity rules. The input is expected to consist
of one path per line, matching the output of `git ls-tree --name-only` including
that pathnames that begin with a double quote (") are interpreted as C-style
quoted strings.
+
When called with the `--rules-file <file>` flag the input files are matched
against the sparse checkout rules found in `<file>` instead of the current ones.
The rules in the files are expected to be in the same form as accepted by `git
sparse-checkout set --stdin` (in particular, they must be newline-delimited).
+
By default, the rules passed to the `--rules-file` option are interpreted as
cone mode directories. To pass non-cone mode patterns with `--rules-file`,
combine the option with the `--no-cone` option.
+
When called with the `-z` flag, the format of the paths input on stdin as well
as the output paths are \0 terminated and not quoted. Note that this does not
apply to the format of the rules passed with the `--rules-file` option.
EXAMPLES
--------
`git sparse-checkout set MY/DIR1 SUB/DIR2`::
Change to a sparse checkout with all files (at any depth) under
MY/DIR1/ and SUB/DIR2/ present in the working copy (plus all
files immediately under MY/ and SUB/ and the toplevel
directory). If already in a sparse checkout, change which files
are present in the working copy to this new selection. Note
that this command will also delete all ignored files in any
directory that no longer has either tracked or
non-ignored-untracked files present.
`git sparse-checkout disable`::
Repopulate the working directory with all files, disabling sparse
checkouts.
`git sparse-checkout add SOME/DIR/ECTORY`::
Add all files under SOME/DIR/ECTORY/ (at any depth) to the
sparse checkout, as well as all files immediately under
SOME/DIR/ and immediately under SOME/. Must already be in a
sparse checkout before using this command.
`git sparse-checkout reapply`::
It is possible for commands to update the working tree in a
way that does not respect the selected sparsity directories.
This can come from tools external to Git writing files, or
even affect Git commands because of either special cases (such
as hitting conflicts when merging/rebasing), or because some
commands didn't fully support sparse checkouts (e.g. the old
`recursive` merge backend had only limited support). This
command reapplies the existing sparse directory specifications
to make the working directory match.
INTERNALS -- SPARSE CHECKOUT
----------------------------
"Sparse checkout" allows populating the working directory sparsely. It
uses the skip-worktree bit (see linkgit:git-update-index[1]) to tell Git
whether a file in the working directory is worth looking at. If the
skip-worktree bit is set, and the file is not present in the working tree,
then its absence is ignored. Git will avoid populating the contents of
those files, which makes a sparse checkout helpful when working in a
repository with many files, but only a few are important to the current
user.
The `$GIT_DIR/info/sparse-checkout` file is used to define the
skip-worktree reference bitmap. When Git updates the working
directory, it updates the skip-worktree bits in the index based
on this file. The files matching the patterns in the file will
appear in the working directory, and the rest will not.
INTERNALS -- NON-CONE PROBLEMS
------------------------------
The `$GIT_DIR/info/sparse-checkout` file populated by the `set` and
`add` subcommands is defined to be a bunch of patterns (one per line)
using the same syntax as `.gitignore` files. In cone mode, these
patterns are restricted to matching directories (and users only ever
need supply or see directory names), while in non-cone mode any
gitignore-style pattern is permitted. Using the full gitignore-style