What 'fetch' invokes to negotiate and receive packs.
git fetch-pack is the client half of object exchange — it talks to a remote upload-pack, negotiates which objects you have versus what you want, and writes the resulting pack into your object store.
Picture a 'have/want' conversation: client lists wants (refs to fetch), then offers haves (commits it already owns); the server walks back until it finds common ancestors and ships only the missing closure as a thin or thick pack.
git fetch-pack [--all] [--quiet|-q] [--keep|-k] [--thin]
[--include-tag] [--upload-pack=<git-upload-pack>]
[--depth=<n>] [--shallow-since=<date>]
[--shallow-exclude=<ref>] [--deepen-relative]
[--no-progress] [--check-self-contained-and-connected]
[--cloning] [-v] <repository> [<refs>...]| Flag | What it does |
|---|---|
--all | Fetch every ref the remote advertises |
--quiet | Suppress non-error output to stderr |
--keep | Keep the downloaded pack rather than letting it be exploded into loose objects |
--thin | Request a thin pack — smaller wire size, fattened locally |
--include-tag | Pull annotated tags that point at fetched commits |
--upload-pack=<path> | Override the path to git-upload-pack on the remote (for non-standard installs) |
--depth=<n> | Create a shallow history truncated to n commits per branch |
--no-progress | Do not emit progress meters — useful in scripts |
--check-self-contained-and-connected | Verify the received pack is fully connected before installing |
--cloning | Internal flag set when called from git clone — relaxes some checks |
git fetch-pack --no-progress git://127.0.0.1/repo.git refs/heads/maingit fetch-pack --depth=1 git@github.com:user/repo.git refs/heads/maingit fetch-pack --upload-pack=/opt/custom/git-upload-pack ssh://host/repo refs/heads/*GIT_TRACE_PACKET=1 git fetch-pack -v --all git://127.0.0.1/repo.gitHit each option, then Check answers. Score is recorded; Next is always open.