Handling repositories with a large number of files
The rise in the use of monorepos (this concept was explained in detail in Chapter 11, Managing Subprojects) has led to the need to handle repositories with large amounts of files. In a monorepo – that is, a repository composed of many interconnected subprojects – you would usually work on a single subproject and access and change files only within a specific subdirectory.
Limiting the number of working directory files with sparse checkout
Git includes the sparse checkout technique, which allows you to explicitly detail which files and folders you want to populate on checkout. This mode can be turned on by setting the core.sparseCheckout
configuration variable to true
and uses the .git/info/sparse-checkout
file with the gitignore-like syntax to specify what is to appear in the working directory. The index (also known as the staging area) is populated in full, with the skip-worktree
flag set for files missing from...