sparse-checkout: add '--stdin' option to set subcommand
[git.git] / Documentation / git-sparse-checkout.txt
bloba724eae09c15563016dbe4e33266114719279969
1 git-sparse-checkout(1)
2 ======================
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.
11 SYNOPSIS
12 --------
13 [verse]
14 'git sparse-checkout <subcommand> [options]'
17 DESCRIPTION
18 -----------
20 Initialize and modify the sparse-checkout configuration, which reduces
21 the checkout to a set of paths given by a list of patterns.
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.
28 COMMANDS
29 --------
30 'list'::
31         Provide a list of the contents in the sparse-checkout file.
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.
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.
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.
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.
54 SPARSE CHECKOUT
55 ---------------
57 "Sparse checkout" allows populating the working directory sparsely.
58 It uses the skip-worktree bit (see linkgit:git-update-index[1]) to tell
59 Git whether a file in the working directory is worth looking at. If
60 the skip-worktree bit is set, then the file is ignored in the working
61 directory. Git will not populate the contents of those files, which
62 makes a sparse checkout helpful when working in a repository with many
63 files, but only a few are important to the current user.
65 The `$GIT_DIR/info/sparse-checkout` file is used to define the
66 skip-worktree reference bitmap. When Git updates the working
67 directory, it updates the skip-worktree bits in the index based
68 on this file. The files matching the patterns in the file will
69 appear in the working directory, and the rest will not.
71 ## FULL PATTERN SET
73 By default, the sparse-checkout file uses the same syntax as `.gitignore`
74 files.
76 While `$GIT_DIR/info/sparse-checkout` is usually used to specify what
77 files are included, you can also specify what files are _not_ included,
78 using negative patterns. For example, to remove the file `unwanted`:
80 ----------------
82 !unwanted
83 ----------------
85 Another tricky thing is fully repopulating the working directory when you
86 no longer want sparse checkout. You cannot just disable "sparse
87 checkout" because skip-worktree bits are still in the index and your working
88 directory is still sparsely populated. You should re-populate the working
89 directory with the `$GIT_DIR/info/sparse-checkout` file content as
90 follows:
92 ----------------
94 ----------------
96 Then you can disable sparse checkout. Sparse checkout support in 'git
97 checkout' and similar commands is disabled by default. You need to
98 set `core.sparseCheckout` to `true` in order to have sparse checkout
99 support.
101 SEE ALSO
102 --------
104 linkgit:git-read-tree[1]
105 linkgit:gitignore[5]
109 Part of the linkgit:git[1] suite