mirror of
https://github.com/git/git
synced 2024-09-13 13:24:41 +00:00
72918c1ad9
The instructions for disabling a sparse-checkout to a full working directory are complicated and non-intuitive. Add a subcommand, 'git sparse-checkout disable', to perform those steps for the user. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
107 lines
3.3 KiB
Plaintext
107 lines
3.3 KiB
Plaintext
git-sparse-checkout(1)
|
|
======================
|
|
|
|
NAME
|
|
----
|
|
git-sparse-checkout - Initialize and modify the sparse-checkout
|
|
configuration, which reduces the checkout to a set of paths
|
|
given by a list of atterns.
|
|
|
|
|
|
SYNOPSIS
|
|
--------
|
|
[verse]
|
|
'git sparse-checkout <subcommand> [options]'
|
|
|
|
|
|
DESCRIPTION
|
|
-----------
|
|
|
|
Initialize and modify the sparse-checkout configuration, which reduces
|
|
the checkout to a set of paths given by a list of patterns.
|
|
|
|
THIS COMMAND IS EXPERIMENTAL. ITS BEHAVIOR, AND THE BEHAVIOR OF OTHER
|
|
COMMANDS IN THE PRESENCE OF SPARSE-CHECKOUTS, WILL LIKELY CHANGE IN
|
|
THE FUTURE.
|
|
|
|
|
|
COMMANDS
|
|
--------
|
|
'list'::
|
|
Provide a list of the contents in the sparse-checkout file.
|
|
|
|
'init'::
|
|
Enable the `core.sparseCheckout` setting. If the
|
|
sparse-checkout file does not exist, then populate it with
|
|
patterns that match every file in the root directory and
|
|
no other directories, then will remove all directories tracked
|
|
by Git. Add patterns to the sparse-checkout file to
|
|
repopulate the working directory.
|
|
+
|
|
To avoid interfering with other worktrees, it first enables the
|
|
`extensions.worktreeConfig` setting and makes sure to set the
|
|
`core.sparseCheckout` setting in the worktree-specific config file.
|
|
|
|
'set'::
|
|
Write a set of patterns to the sparse-checkout file, as given as
|
|
a list of arguments following the 'set' subcommand. Update the
|
|
working directory to match the new patterns. Enable the
|
|
core.sparseCheckout config setting if it is not already enabled.
|
|
+
|
|
When the `--stdin` option is provided, the patterns are read from
|
|
standard in as a newline-delimited list instead of from the arguments.
|
|
|
|
'disable'::
|
|
Remove the sparse-checkout file, set `core.sparseCheckout` to
|
|
`false`, and restore the working directory to include all files.
|
|
|
|
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, then the file is ignored in the working
|
|
directory. Git will not populate 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.
|
|
|
|
To enable the sparse-checkout feature, run `git sparse-checkout init` to
|
|
initialize a simple sparse-checkout file and enable the `core.sparseCheckout`
|
|
config setting. Then, run `git sparse-checkout set` to modify the patterns in
|
|
the sparse-checkout file.
|
|
|
|
To repopulate the working directory with all files, use the
|
|
`git sparse-checkout disable` command.
|
|
|
|
## FULL PATTERN SET
|
|
|
|
By default, the sparse-checkout file uses the same syntax as `.gitignore`
|
|
files.
|
|
|
|
While `$GIT_DIR/info/sparse-checkout` is usually used to specify what
|
|
files are included, you can also specify what files are _not_ included,
|
|
using negative patterns. For example, to remove the file `unwanted`:
|
|
|
|
----------------
|
|
/*
|
|
!unwanted
|
|
----------------
|
|
|
|
|
|
SEE ALSO
|
|
--------
|
|
|
|
linkgit:git-read-tree[1]
|
|
linkgit:gitignore[5]
|
|
|
|
GIT
|
|
---
|
|
Part of the linkgit:git[1] suite
|