git-send-pack
Transmit objects to another repository
SYNOPSIS
git send-pack [--all] [--dry-run] [--force] [--atomic] [--[no-]recurse-submodules] [--thin] [--[no-]verbose] [--[no-]progress] <repository> [<refspec>...]
PARAMETERS
<repository>
The URL or path of the remote repository to send objects to.
<refspec>...
One or more refspecs indicating which local references (e.g., branches or tags) should be sent to the remote, and optionally, which remote reference should be updated. A common format is <local_ref>:<remote_ref>
.
--all
Push all branches under refs/heads/
, refs/tags/
and refs/for/
by updating the same name on the remote side.
--dry-run
Perform all operations as if pushing, but do not actually send any data or update remote references.
--force
Override checks that prevent non-fast-forward updates. This can lead to losing data on the remote.
--atomic
Use an atomic transaction on the remote side if the remote repository supports it, ensuring either all references are updated or none are.
--[no-]recurse-submodules
Control whether pushed submodule commits are also pushed to their configured remotes. --no-recurse-submodules
overrides the push.recurseSubmodules
configuration.
--thin
Request the remote to send a "thin" pack, which omits objects that are already expected to exist on the remote.
--[no-]verbose
Be more verbose (or less verbose) during the operation, showing more details about the negotiation and transfer.
--[no-]progress
Show (or hide) progress status messages on the standard error stream during the transfer.
DESCRIPTION
git-send-pack
is a low-level plumbing command in Git, primarily used internally by git push
and git fetch
for communicating with a remote repository. It's responsible for sending pack files, which are compressed archives of Git objects (commits, trees, blobs, tags), along with reference updates, to a remote git-receive-pack
process.
This command operates on the client side during a push operation. It reads the desired references and objects from the local repository, negotiates with the remote to determine which objects are missing, creates a pack file containing those objects, and then transmits the pack file and reference updates over the network. Users typically interact with the higher-level git push
command, which orchestrates the call to git-send-pack
behind the scenes. Its direct use is rare, mostly for scripting or debugging advanced Git protocols.
CAVEATS
This is a plumbing command, intended for low-level Git operations and scripting, not for typical end-user interaction.
Direct use requires a deep understanding of Git's internal protocol and object model.
It relies on a compatible git-receive-pack
process running on the remote side.
PROTOCOL COMMUNICATION
git-send-pack
communicates with git-receive-pack
on the remote side using Git's "smart protocol". This involves an initial capabilities negotiation, followed by a phase where the local side informs the remote about its current references and desired updates, and then the actual transfer of missing objects within a pack file.
PACK FILES
The command's name highlights its primary function: sending pack files. These are highly efficient, compressed archives of Git objects. By sending only the objects that are missing on the remote and grouping them into a single file, Git minimizes network traffic and improves transfer speed significantly.
HISTORY
git-send-pack
has been a fundamental component of Git's network protocol since its early inception. It's integral to how Git synchronizes repositories over the network efficiently, particularly for push operations. Its development has focused on refining the underlying protocol for robustness and performance, including improvements in pack formats and capabilities negotiation. While the details of the protocol have evolved, its core function as the client-side sender of pack data and reference updates remains consistent.
SEE ALSO
git-push(1), git-fetch(1), git-receive-pack(1), git-pack-objects(1), git-upload-pack(1)