@@ -3,9 +3,7 @@ git-sparse-checkout(1)
33
44NAME
55----
6- git-sparse-checkout - Initialize and modify the sparse-checkout
7- configuration, which reduces the checkout to a set of paths
8- given by a list of patterns.
6+ git-sparse-checkout - Reduce your working tree to a subset of tracked files
97
108
119SYNOPSIS
@@ -17,8 +15,20 @@ SYNOPSIS
1715DESCRIPTION
1816-----------
1917
20- Initialize and modify the sparse-checkout configuration, which reduces
21- the checkout to a set of paths given by a list of patterns.
18+ This command is used to create sparse checkouts, which means that it
19+ changes the working tree from having all tracked files present, to only
20+ have a subset of them. It can also switch which subset of files are
21+ present, or undo and go back to having all tracked files present in the
22+ working copy.
23+
24+ The subset of files is chosen by providing a list of directories in
25+ cone mode (which is recommended), or by providing a list of patterns
26+ in non-cone mode.
27+
28+ When in a sparse-checkout, other Git commands behave a bit differently.
29+ For example, switching branches will not update paths outside the
30+ sparse-checkout directories/patterns, and `git commit -a` will not record
31+ paths outside the sparse-checkout directories/patterns as deleted.
2232
2333THIS COMMAND IS EXPERIMENTAL. ITS BEHAVIOR, AND THE BEHAVIOR OF OTHER
2434COMMANDS IN THE PRESENCE OF SPARSE-CHECKOUTS, WILL LIKELY CHANGE IN
@@ -28,7 +38,7 @@ THE FUTURE.
2838COMMANDS
2939--------
3040'list'::
31- Describe the patterns in the sparse-checkout file.
41+ Describe the directories or patterns in the sparse-checkout file.
3242
3343'set'::
3444 Enable the necessary sparse-checkout config settings
@@ -46,20 +56,26 @@ the 'set' subcommand are stored in the worktree-specific sparse-checkout
4656file. See linkgit:git-worktree[1] and the documentation of
4757`extensions.worktreeConfig` in linkgit:git-config[1] for more details.
4858+
49- When the `--stdin` option is provided, the patterns are read from
50- standard in as a newline-delimited list instead of from the arguments.
59+ When the `--stdin` option is provided, the directories or patterns are
60+ read from standard in as a newline-delimited list instead of from the
61+ arguments.
5162+
5263When `--cone` is passed or `core.sparseCheckoutCone` is enabled, the
53- input list is considered a list of directories instead of
54- sparse-checkout patterns. This allows for better performance with a
55- limited set of patterns (see 'CONE PATTERN SET' below). Note that the
56- set command will write patterns to the sparse-checkout file to include
57- all files contained in those directories (recursively) as well as
58- files that are siblings of ancestor directories. The input format
59- matches the output of `git ls-tree --name-only`. This includes
60- interpreting pathnames that begin with a double quote (") as C-style
61- quoted strings. This may become the default in the future; --no-cone
62- can be passed to request non-cone mode.
64+ input list is considered a list of directories. This allows for
65+ better performance with a limited set of patterns (see 'CONE PATTERN
66+ SET' below). The input format matches the output of `git ls-tree
67+ --name-only`. This includes interpreting pathnames that begin with a
68+ double quote (") as C-style quoted strings. Note that the set command
69+ will write patterns to the sparse-checkout file to include all files
70+ contained in those directories (recursively) as well as files that are
71+ siblings of ancestor directories. This may become the default in the
72+ future; --no-cone can be passed to request non-cone mode.
73+ +
74+ When `--no-cone` is passed or `core.sparseCheckoutCone` is not enabled,
75+ the input list is considered a list of patterns. This mode is harder
76+ to use and less performant, and is thus not recommended. See the
77+ "Sparse Checkout" section of linkgit:git-read-tree[1] and the "Pattern
78+ Set" sections below for more details.
6379+
6480Use the `--[no-]sparse-index` option to use a sparse index (the
6581default is to not use it). A sparse index reduces the size of the
@@ -77,11 +93,10 @@ understand the sparse directory entries index extension and may fail to
7793interact with your repository until it is disabled.
7894
7995'add'::
80- Update the sparse-checkout file to include additional patterns.
81- By default, these patterns are read from the command-line arguments,
82- but they can be read from stdin using the `--stdin` option. When
83- `core.sparseCheckoutCone` is enabled, the given patterns are interpreted
84- as directory names as in the 'set' subcommand.
96+ Update the sparse-checkout file to include additional directories
97+ (in cone mode) or patterns (in non-cone mode). By default, these
98+ directories or patterns are read from the command-line arguments,
99+ but they can be read from stdin using the `--stdin` option.
85100
86101'reapply'::
87102 Reapply the sparsity pattern rules to paths in the working tree.
@@ -125,13 +140,14 @@ decreased in utility.
125140SPARSE CHECKOUT
126141---------------
127142
128- "Sparse checkout" allows populating the working directory sparsely.
129- It uses the skip-worktree bit (see linkgit:git-update-index[1]) to tell
130- Git whether a file in the working directory is worth looking at. If
131- the skip-worktree bit is set, then the file is ignored in the working
132- directory. Git will avoid populating the contents of those files, which
133- makes a sparse checkout helpful when working in a repository with many
134- files, but only a few are important to the current user.
143+ "Sparse checkout" allows populating the working directory sparsely. It
144+ uses the skip-worktree bit (see linkgit:git-update-index[1]) to tell Git
145+ whether a file in the working directory is worth looking at. If the
146+ skip-worktree bit is set, and the file is not present in the working tree,
147+ then its absence is ignored. Git will avoid populating the contents of
148+ those files, which makes a sparse checkout helpful when working in a
149+ repository with many files, but only a few are important to the current
150+ user.
135151
136152The `$GIT_DIR/info/sparse-checkout` file is used to define the
137153skip-worktree reference bitmap. When Git updates the working
0 commit comments