LinuxCommandLibrary

git-sparse-checkout

Partially check out only specified directories

TLDR

Initialize sparse checkout

$ git sparse-checkout init
copy
Set sparse directories
$ git sparse-checkout set [dir1] [dir2]
copy
Add to sparse checkout
$ git sparse-checkout add [dir]
copy
List sparse patterns
$ git sparse-checkout list
copy
Disable sparse checkout
$ git sparse-checkout disable
copy
Use cone mode
$ git sparse-checkout init --cone
copy

SYNOPSIS

git sparse-checkout command [options]

DESCRIPTION

git sparse-checkout enables partial repository checkouts, where only specified directories and files are materialized in the working tree. This significantly reduces working directory size for large monorepos.
Cone mode (recommended) restricts patterns to directory-based inclusion, which is faster and simpler than full pattern matching.

PARAMETERS

--cone

Use cone mode (faster).
--no-cone
Use full pattern mode.

CONFIGURATION

.git/info/sparse-checkout

File containing the sparse-checkout patterns that control which paths are checked out.

SUBCOMMANDS

init

Initialize sparse checkout.
set
Set patterns.
add
Add patterns.
list
List patterns.
disable
Disable sparse checkout.
reapply
Reapply patterns.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community