3
4
NAME
5
----
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
7
8
9
SYNOPSIS
15
DESCRIPTION
16
-----------
17
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.
32
33
THIS COMMAND IS EXPERIMENTAL. ITS BEHAVIOR, AND THE BEHAVIOR OF OTHER
34
COMMANDS IN THE PRESENCE OF SPARSE-CHECKOUTS, WILL LIKELY CHANGE IN
38
COMMANDS
39
--------
40
'list'::
31
- Describe the patterns in the sparse-checkout file.
41
+ Describe the directories or patterns in the sparse-checkout file.
42
43
'set'::
44
Enable the necessary config settings
48
list of arguments following the 'set' subcommand. Update the
49
working directory to match the new patterns.
50
+
41
-When the `--stdin` option is provided, the patterns are read from
42
-standard in as a newline-delimited list instead of from the arguments.
51
+When the `--stdin` option is provided, the directories or patterns are
52
+read from standard in as a newline-delimited list instead of from the
53
+arguments.
54
+
55
When `--cone` is passed or `core.sparseCheckoutCone` is enabled, the
45
-input list is considered a list of directories instead of
46
-sparse-checkout patterns. This allows for better performance with a
47
-limited set of patterns (see 'CONE PATTERN SET' below). Note that the
48
-set command will write patterns to the sparse-checkout file to include
49
-all files contained in those directories (recursively) as well as
50
-files that are siblings of ancestor directories. The input format
51
-matches the output of `git ls-tree --name-only`. This includes
52
-interpreting pathnames that begin with a double quote (") as C-style
53
-quoted strings. This may become the default in the future; --no-cone
54
-can be passed to request non-cone mode.
56
+input list is considered a list of directories. This allows for
57
+better performance with a limited set of patterns (see 'CONE PATTERN
58
+SET' below). The input format matches the output of `git ls-tree
59
+--name-only`. This includes interpreting pathnames that begin with a
60
+double quote (") as C-style quoted strings. Note that the set command
61
+will write patterns to the sparse-checkout file to include all files
62
+contained in those directories (recursively) as well as files that are
63
+siblings of ancestor directories. This may become the default in the
64
+future; --no-cone can be passed to request non-cone mode.
65
++
66
+When `--no-cone` is passed or `core.sparseCheckoutCone` is not enabled,
67
+the input list is considered a list of patterns. This mode is harder
68
+to use and less performant, and is thus not recommended. See the
69
+"Sparse Checkout" section of linkgit:git-read-tree[1] and the "Pattern
70
+Set" sections below for more details.
71
+
72
Use the `--[no-]sparse-index` option to use a sparse index (the
73
default is to not use it). A sparse index reduces the size of the
85
interact with your repository until it is disabled.
86
87
'add'::
72
- Update the sparse-checkout file to include additional patterns.
73
- By default, these patterns are read from the command-line arguments,
74
- but they can be read from stdin using the `--stdin` option. When
75
- `core.sparseCheckoutCone` is enabled, the given patterns are interpreted
76
- as directory names as in the 'set' subcommand.
88
+ Update the sparse-checkout file to include additional directories
89
+ (in cone mode) or patterns (in non-cone mode). By default, these
90
+ directories or patterns are read from the command-line arguments,
91
+ but they can be read from stdin using the `--stdin` option.
92
93
'reapply'::
94
Reapply the sparsity pattern rules to paths in the working tree.
132
SPARSE CHECKOUT
133
---------------
134
120
-"Sparse checkout" allows populating the working directory sparsely.
121
-It uses the skip-worktree bit (see linkgit:git-update-index[1]) to tell
122
-Git whether a file in the working directory is worth looking at. If
123
-the skip-worktree bit is set, then the file is ignored in the working
124
-directory. Git will avoid populating the contents of those files, which
125
-makes a sparse checkout helpful when working in a repository with many
126
-files, but only a few are important to the current user.
135
+"Sparse checkout" allows populating the working directory sparsely. It
136
+uses the skip-worktree bit (see linkgit:git-update-index[1]) to tell Git
137
+whether a file in the working directory is worth looking at. If the
138
+skip-worktree bit is set, and the file is not present in the working tree,
139
+then its absence is ignored. Git will avoid populating the contents of
140
+those files, which makes a sparse checkout helpful when working in a
141
+repository with many files, but only a few are important to the current
142
+user.
143
144
The `$GIT_DIR/info/sparse-checkout` file is used to define the
145
skip-worktree reference bitmap. When Git updates the working