считывает информацию о дереве в индекс (Reads tree information into the index)
SPARSE CHECKOUT
"Sparse checkout" allows populating the working directory
sparsely. It uses the skip-worktree bit (see git-update-index(1))
to tell Git whether a file in the working directory is worth
looking at.
git read-tree and other merge-based commands (git merge, git
checkout...) can help maintaining the skip-worktree bitmap and
working directory update. $GIT_DIR/info/sparse-checkout
is used
to define the skip-worktree reference bitmap. When git read-tree
needs to update the working directory, it resets the
skip-worktree bit in the index based on this file, which uses the
same syntax as .gitignore files. If an entry matches a pattern in
this file, skip-worktree will not be set on that entry.
Otherwise, skip-worktree will be set.
Then it compares the new skip-worktree value with the previous
one. If skip-worktree turns from set to unset, it will add the
corresponding file back. If it turns from unset to set, that file
will be removed.
While $GIT_DIR/info/sparse-checkout
is usually used to specify
what files are in, you can also specify what files are not in,
using negate patterns. For example, to remove the file unwanted
:
/*
!unwanted
Another tricky thing is fully repopulating the working directory
when you no longer want sparse checkout. You cannot just disable
"sparse checkout" because skip-worktree bits are still in the
index and your working directory is still sparsely populated. You
should re-populate the working directory with the
$GIT_DIR/info/sparse-checkout
file content as follows:
/*
Then you can disable sparse checkout. Sparse checkout support in
git read-tree and similar commands is disabled by default. You
need to turn core.sparseCheckout
on in order to have sparse
checkout support.