git-fetch-pack
Receive missing Git objects from another repository
SYNOPSIS
git fetch-pack [options] <repository> [<ref-list> ...]
PARAMETERS
--all
Fetch all remote refs instead of specific ones
--stdin
Read refs to fetch from standard input
--quiet, -q
Suppress progress reporting; be silent
--keep, -k
Keep downloaded packfile; do not import objects
--thin
Request thin packfile from server (smaller transfers)
--upload-pack=<exec>
Path to git-upload-pack on remote host
--exec=<exec>
Command to execute on remote for upload-pack
-t, --tags
Fetch all tags in addition to heads
-a, --all
Fetch all heads (deprecated; use --all)
-c
Check self-contained and connected after fetch
--dry-run
Dry run; do not actually fetch
--depth=<n>
Limit history depth to n commits (shallow fetch)
--shallow-since=<date>
Shallow fetch excluding commits before date
--shallow-exclude=<rev>
Shallow fetch excluding descendants of rev
--no-progress
Disable progress display
--include-tag
Include tags with fetched objects
--no-deps
Disable dependency tracking
DESCRIPTION
git-fetch-pack is a plumbing command in Git, designed for internal use by higher-level commands like git fetch and git pull. It downloads objects and references from a remote Git repository over various protocols such as git://, HTTP/HTTPS, or SSH.
This command implements the client side of Git's packfile protocol, negotiating with the remote git-upload-pack to receive necessary objects efficiently, including handling deltas, thin packs, and shallow fetches. It supports fetching specific refs or all refs, and can verify downloaded data for completeness and connectivity.
Direct usage is rare for end-users due to its low-level nature and lack of porcelain features like progress bars or error handling. Instead, it's invoked indirectly. When used directly, it requires specifying the repository URL and optionally refs to fetch. It outputs pack data to stdout or files, making it suitable for scripted or custom transport integrations.
Key features include support for shallow clones (--depth), thin transfers for bandwidth savings, and dry-run modes for testing.
CAVEATS
Plumbing command; subject to change without notice. Not for interactive use. Requires network access and compatible remote server. May produce large temporary files. Use git fetch for user-facing operations.
PROTOCOLS
Supports git://, http(s)://, ssh://, file://, and custom transports via --upload-pack.
OUTPUT
Writes packfile to .git/objects/pack/ or stdout with --keep; refs updated in FETCH_HEAD.
HISTORY
Introduced in Git 1.0 (2005) as core transport plumbing by Linus Torvalds. Evolved with pack protocol v2 (Git 2.20+), thin packs (Git 1.7.5+), and shallow support. Remains essential for Git's distributed model.
SEE ALSO
git-fetch(1), git-upload-pack(1), git-receive-pack(1), git-pack-objects(1)


