Progress:
TIER 3 · MODULE 48· Expert

git send-pack

What 'push' invokes to ship a pack to the remote.

🎯 What & why

git send-pack is the client half of push — it negotiates with the remote's receive-pack, builds a pack of objects the remote lacks, and sends update lines of the form 'old-sha new-sha refname'.

🧠 Mental model

Imagine a three-step handshake: receive ref advertisement, compute which refs to update with which old/new SHAs, ship the pack plus the update commands. The remote applies them atomically per-ref (or all-or-nothing with --atomic).

🛠️ Synopsis

git send-pack [--all] [--mirror] [--dry-run] [--force]
              [--receive-pack=<git-receive-pack>] [--verbose] [--thin]
              [--atomic] [--[no-]signed | --signed=(true|false|if-asked)]
              [--push-option=<string>] [--stdin]
              [<host>:]<directory> [<ref>...]

🎚️ Switches & options

FlagWhat it does
--allPush every local branch
--mirrorPush every ref under refs/ and delete remote refs that no longer exist locally
--dry-runNegotiate but do not actually update remote refs
--force⚠️ Allow non-fast-forward updates — overwrites remote history
--receive-pack=<path>Override the path to git-receive-pack on the remote
--verboseEmit detailed progress to stderr
--thinSend a thin pack — smaller wire size, fattened on the receiver
--atomicEither all ref updates succeed or none do
--signedGPG-sign the push certificate so the server can verify the pusher
--push-option=<string>Pass an arbitrary string to server-side hooks (repeatable)
--stdinRead refspecs from standard input instead of arguments

💡 Use cases

🧪 Examples

Dry-run a push to a local daemon
git send-pack --dry-run --verbose git://127.0.0.1/repo.git refs/heads/main
Atomic push of two refs
git send-pack --atomic origin refs/heads/main refs/heads/release
Mirror to a backup remote
git send-pack --mirror backup-mirror
Pipe refspecs from a script
printf 'refs/heads/main\nrefs/tags/v1.0\n' | git send-pack --stdin origin

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

Hit each option, then Check answers. Score is recorded; Next is always open.