]>
Commit | Line | Data |
---|---|---|
94c0956b DS |
1 | git-sparse-checkout(1) |
2 | ====================== | |
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 atterns. | |
9 | ||
10 | ||
11 | SYNOPSIS | |
12 | -------- | |
13 | [verse] | |
14 | 'git sparse-checkout <subcommand> [options]' | |
15 | ||
16 | ||
17 | DESCRIPTION | |
18 | ----------- | |
19 | ||
20 | Initialize and modify the sparse-checkout configuration, which reduces | |
21 | the checkout to a set of paths given by a list of patterns. | |
22 | ||
23 | THIS COMMAND IS EXPERIMENTAL. ITS BEHAVIOR, AND THE BEHAVIOR OF OTHER | |
24 | COMMANDS IN THE PRESENCE OF SPARSE-CHECKOUTS, WILL LIKELY CHANGE IN | |
25 | THE FUTURE. | |
26 | ||
27 | ||
28 | COMMANDS | |
29 | -------- | |
30 | 'list':: | |
31 | Provide a list of the contents in the sparse-checkout file. | |
32 | ||
bab3c359 DS |
33 | 'init':: |
34 | Enable the `core.sparseCheckout` setting. If the | |
35 | sparse-checkout file does not exist, then populate it with | |
36 | patterns that match every file in the root directory and | |
37 | no other directories, then will remove all directories tracked | |
38 | by Git. Add patterns to the sparse-checkout file to | |
39 | repopulate the working directory. | |
40 | + | |
41 | To avoid interfering with other worktrees, it first enables the | |
42 | `extensions.worktreeConfig` setting and makes sure to set the | |
43 | `core.sparseCheckout` setting in the worktree-specific config file. | |
94c0956b | 44 | |
f6039a94 DS |
45 | 'set':: |
46 | Write a set of patterns to the sparse-checkout file, as given as | |
47 | a list of arguments following the 'set' subcommand. Update the | |
48 | working directory to match the new patterns. Enable the | |
49 | core.sparseCheckout config setting if it is not already enabled. | |
7bffca95 DS |
50 | + |
51 | When the `--stdin` option is provided, the patterns are read from | |
52 | standard in as a newline-delimited list instead of from the arguments. | |
f6039a94 | 53 | |
72918c1a DS |
54 | 'disable':: |
55 | Remove the sparse-checkout file, set `core.sparseCheckout` to | |
56 | `false`, and restore the working directory to include all files. | |
57 | ||
94c0956b DS |
58 | SPARSE CHECKOUT |
59 | --------------- | |
60 | ||
61 | "Sparse checkout" allows populating the working directory sparsely. | |
62 | It uses the skip-worktree bit (see linkgit:git-update-index[1]) to tell | |
63 | Git whether a file in the working directory is worth looking at. If | |
64 | the skip-worktree bit is set, then the file is ignored in the working | |
65 | directory. Git will not populate the contents of those files, which | |
66 | makes a sparse checkout helpful when working in a repository with many | |
67 | files, but only a few are important to the current user. | |
68 | ||
69 | The `$GIT_DIR/info/sparse-checkout` file is used to define the | |
70 | skip-worktree reference bitmap. When Git updates the working | |
71 | directory, it updates the skip-worktree bits in the index based | |
72 | on this file. The files matching the patterns in the file will | |
73 | appear in the working directory, and the rest will not. | |
74 | ||
72918c1a DS |
75 | To enable the sparse-checkout feature, run `git sparse-checkout init` to |
76 | initialize a simple sparse-checkout file and enable the `core.sparseCheckout` | |
77 | config setting. Then, run `git sparse-checkout set` to modify the patterns in | |
78 | the sparse-checkout file. | |
79 | ||
80 | To repopulate the working directory with all files, use the | |
81 | `git sparse-checkout disable` command. | |
82 | ||
94c0956b DS |
83 | ## FULL PATTERN SET |
84 | ||
85 | By default, the sparse-checkout file uses the same syntax as `.gitignore` | |
86 | files. | |
87 | ||
88 | While `$GIT_DIR/info/sparse-checkout` is usually used to specify what | |
89 | files are included, you can also specify what files are _not_ included, | |
90 | using negative patterns. For example, to remove the file `unwanted`: | |
91 | ||
92 | ---------------- | |
93 | /* | |
94 | !unwanted | |
95 | ---------------- | |
96 | ||
94c0956b DS |
97 | |
98 | SEE ALSO | |
99 | -------- | |
100 | ||
101 | linkgit:git-read-tree[1] | |
102 | linkgit:gitignore[5] | |
103 | ||
104 | GIT | |
105 | --- | |
106 | Part of the linkgit:git[1] suite |