GIT-SEND-PACK(1)

πŸ’Œ GIT-SEND-PACK(1) β€” the git manual, but make it make sense

okay so bestie, welcome to git-send-pack, straight out of the Git Manual πŸ’…. This is the low-level little gremlin that actually shoves your objects over the Git protocol into another repo. Buckle up, it's giving plumbing 🫢


🌸 NAME 🌸

git-send-pack β€” push objects over Git protocol to another repository

✨ SYNOPSIS ✨

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

πŸ’– DESCRIPTION πŸ’–

ngl, most of the time you do not want to be here. You want git push, which is the higher-level wrapper around this command β€” the main character, if you will πŸ‘‘. Peep git-push(1) for that.

But if you're curious what's under the hood: this command invokes git-receive-pack on a possibly-remote repository, and updates it from the current repository, sending the named refs. That's it, that's the vibe πŸ’«


πŸŽ€ OPTIONS πŸŽ€

  • --receive-pack=<git-receive-pack> β€” the path to the git-receive-pack program on the remote end. Super handy when you're pushing to a remote repo over ssh and the program just isn't chilling in a directory on the default $PATH 😭
  • --exec=<git-receive-pack> β€” literally the same thing as --receive-pack=<git-receive-pack>. twins fr fr πŸ‘―
  • --all β€” instead of listing which refs to update one by one, just update all the heads that exist locally. slay, do the whole thing ✨
  • --stdin β€” take the list of refs from stdin, one per line. And if you've also got refs on the command line besides this option, bestie, the stdin refs get processed after the command-line ones, in that order 🫑
    • if --stateless-rpc is specified together with this option, then the list of refs must be in packet format (pkt-line). Each ref has to be in a separate packet, and the list must end with a flush packet. no skipping this, it's the rules πŸ“œ
  • --dry-run β€” do everything except actually send the updates. a little dress rehearsal, a little run-through, zero commitment πŸ™ˆ
  • --force β€” usually the command refuses to update a remote ref that isn't an ancestor of the local ref used to overwrite it. This flag disables that check. Which means: the remote repository can lose commits. use it with care, genuinely 😭⚠️
  • --verbose β€” run verbosely. it's giving chatty πŸ’¬
  • --thin β€” send a "thin" pack, which records objects in deltified form based on objects not included in the pack, to reduce network traffic. skinny legend behavior πŸ¦‹
  • --atomic β€” use an atomic transaction for updating the refs. If any of the refs fails to update, then the entire push will fail without changing any refs. all-or-nothing, periodt πŸ’…
  • --signed, --no-signed, --signed=(true|false|if-asked) β€” GPG-sign the push request to update refs on the receiving side, so it can be checked by the hooks and/or be logged πŸ”
    • if false or --no-signed, no signing will be attempted πŸ™…
    • if true or --signed, the push will fail if the server does not support signed pushes 😬
    • if set to if-asked, sign if and only if the server supports signed pushes. chill, conditional, respectful 🌸
    • the push will also fail if the actual call to gpg --sign fails. also see git-receive-pack(1) for the details on the receiving end πŸ‘€
  • --push-option=<string> β€” pass the specified string as a push option for consumption by hooks on the server side. If the server doesn't support push options, error out. See git-push(1) and githooks(5) for details πŸ“¬
  • <host> β€” a remote host to house the repository. When this part is specified, git-receive-pack is invoked via ssh πŸ–₯️
  • <directory> β€” the repository to update
  • <ref>... β€” the remote refs to update

πŸ¦‹ SPECIFYING THE REFS πŸ¦‹

okay so there are three ways to specify which refs get updated on the remote end. pick your fighter:

With the --all flag, all refs that exist locally are transferred to the remote side. And no, you cannot specify any <ref> if you use this flag β€” it's exclusive, it doesn't share the spotlight 🎀

Without --all and without any <ref>, the heads that exist both on the local side and on the remote side are updated. the overlap, the mutuals, iykyk 🀝

When one or more <ref> are specified explicitly (whether on the command line or via --stdin), it can be either a single pattern, or a pair of such patterns separated by a colon ":" β€” which means a ref name cannot have a colon in it, sorry to that one ref name 🚫. A single pattern <name> is just shorthand for <name>:<name>. cute, efficient, iconic ✨

Each pattern pair consists of the source side (before the colon πŸ’–) and the destination side (after the colon 🎯). The ref to be pushed is determined by finding a match that matches the source side, and where it's pushed is determined by using the destination side. The rules used to match a ref are the same rules used by git rev-parse to resolve a symbolic ref name. See git-rev-parse(1) πŸ”

  • It is an error if <src> does not match exactly one of the local refs πŸ’€
  • It is an error if <dst> matches more than one remote ref πŸ’€
  • If <dst> does not match any remote ref, either:
    • it has to start with "refs/"; <dst> is used as the destination literally in this case πŸ“Œ
    • <src> == <dst> and the ref that matched the <src> must not exist in the set of remote refs; the ref matched <src> locally is used as the name of the destination πŸͺž

Without --force, the <src> ref is stored at the remote only if <dst> does not exist, or <dst> is a proper subset (i.e. an ancestor) of <src>. This check, known as the "fast-forward check", is performed to avoid accidentally overwriting the remote ref and losing other people's commits from there. protect the commits at all costs πŸ›‘οΈπŸ˜­

With --force, the fast-forward check is disabled for all refs. all of them. no survivors πŸ”₯

Optionally, a <ref> parameter can be prefixed with a plus + sign to disable the fast-forward check only on that ref. targeted chaos, we love a precise queen πŸ’…


🌈 GIT 🌈

Part of the git(1) suite 🫢


that's the whole page bestie, go forth and push responsibly πŸ’œβœ¨

this was Git 2.56.0, dated 2026-09-27 β€” mwah, see you in the next manpage πŸŽ€

πŸ“¦ where this page comes from