<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<article lang="en" id="git-send-pack(1)">
<articleinfo>
    <title>git-send-pack(1)</title>
        <indexterm>
                <primary>git-send-pack(1)</primary>
        </indexterm>
</articleinfo>
<simplesect id="_name">
<title>NAME</title>
<simpara>git-send-pack - Push objects over git protocol to another repository</simpara>
</simplesect>
<simplesect id="_synopsis">
<title>SYNOPSIS</title>
<simpara><emphasis>git send-pack</emphasis> [--all] [--dry-run] [--force] [--receive-pack=&lt;git-receive-pack&gt;] [--verbose] [--thin] [&lt;host&gt;:]&lt;directory&gt; [&lt;ref&gt;&#8230;]</simpara>
</simplesect>
<simplesect id="_description">
<title>DESCRIPTION</title>
<simpara>Usually you would want to use <emphasis>git-push</emphasis>, which is a
higher-level wrapper of this command, instead. See <xref linkend="git-push(1)"/>.</simpara>
<simpara>Invokes <emphasis>git-receive-pack</emphasis> on a possibly remote repository, and
updates it from the current repository, sending named refs.</simpara>
</simplesect>
<simplesect id="_options">
<title>OPTIONS</title>
<variablelist>
<varlistentry>
<term>
--receive-pack=&lt;git-receive-pack&gt;
</term>
<listitem>
<simpara>
        Path to the <emphasis>git-receive-pack</emphasis> program on the remote
        end.  Sometimes useful when pushing to a remote
        repository over ssh, and you do not have the program in
        a directory on the default $PATH.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--exec=&lt;git-receive-pack&gt;
</term>
<listitem>
<simpara>
        Same as --receive-pack=&lt;git-receive-pack&gt;.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--all
</term>
<listitem>
<simpara>
        Instead of explicitly specifying which refs to update,
        update all heads that locally exist.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--dry-run
</term>
<listitem>
<simpara>
        Do everything except actually send the updates.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--force
</term>
<listitem>
<simpara>
        Usually, the command refuses to update a remote ref that
        is not an ancestor of the local ref used to overwrite it.
        This flag disables the check.  What this means is that
        the remote repository can lose commits; use it with
        care.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--verbose
</term>
<listitem>
<simpara>
        Run verbosely.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--thin
</term>
<listitem>
<simpara>
        Spend extra cycles to minimize the number of objects to be sent.
        Use it on slower connection.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
&lt;host&gt;
</term>
<listitem>
<simpara>
        A remote host to house the repository.  When this
        part is specified, <emphasis>git-receive-pack</emphasis> is invoked via
        ssh.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
&lt;directory&gt;
</term>
<listitem>
<simpara>
        The repository to update.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
&lt;ref&gt;&#8230;
</term>
<listitem>
<simpara>
        The remote refs to update.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</simplesect>
<simplesect id="_specifying_the_refs">
<title>Specifying the Refs</title>
<simpara>There are three ways to specify which refs to update on the
remote end.</simpara>
<simpara>With <emphasis>--all</emphasis> flag, all refs that exist locally are transferred to
the remote side.  You cannot specify any <emphasis>&lt;ref&gt;</emphasis> if you use
this flag.</simpara>
<simpara>Without <emphasis>--all</emphasis> and without any <emphasis>&lt;ref&gt;</emphasis>, the heads that exist
both on the local side and on the remote side are updated.</simpara>
<simpara>When one or more <emphasis>&lt;ref&gt;</emphasis> are specified explicitly, it can be either a
single pattern, or a pair of such pattern separated by a colon
":" (this means that a ref name cannot have a colon in it).  A
single pattern <emphasis>&lt;name&gt;</emphasis> is just a shorthand for <emphasis>&lt;name&gt;:&lt;name&gt;</emphasis>.</simpara>
<simpara>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 is pushed is determined by using the
destination side. The rules used to match a ref are the same
rules used by <emphasis>git-rev-parse</emphasis> to resolve a symbolic ref
name. See <xref linkend="git-rev-parse(1)"/>.</simpara>
<itemizedlist>
<listitem>
<simpara>
It is an error if &lt;src&gt; does not match exactly one of the
   local refs.
</simpara>
</listitem>
<listitem>
<simpara>
It is an error if &lt;dst&gt; matches more than one remote refs.
</simpara>
</listitem>
<listitem>
<simpara>
If &lt;dst&gt; does not match any remote ref, either
</simpara>
<itemizedlist>
<listitem>
<simpara>
it has to start with "refs/"; &lt;dst&gt; is used as the
     destination literally in this case.
</simpara>
</listitem>
<listitem>
<simpara>
&lt;src&gt; == &lt;dst&gt; and the ref that matched the &lt;src&gt; must not
     exist in the set of remote refs; the ref matched &lt;src&gt;
     locally is used as the name of the destination.
</simpara>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist>
<simpara>Without <emphasis>--force</emphasis>, the &lt;src&gt; ref is stored at the remote only if
&lt;dst&gt; does not exist, or &lt;dst&gt; is a proper subset (i.e. an
ancestor) of &lt;src&gt;.  This check, known as "fast forward check",
is performed in order to avoid accidentally overwriting the
remote ref and lose other peoples' commits from there.</simpara>
<simpara>With <emphasis>--force</emphasis>, the fast forward check is disabled for all refs.</simpara>
<simpara>Optionally, a &lt;ref&gt; parameter can be prefixed with a plus <emphasis>+</emphasis> sign
to disable the fast-forward check only on that ref.</simpara>
</simplesect>
<simplesect id="_author">
<title>Author</title>
<simpara>Written by Linus Torvalds &lt;<ulink url="mailto:torvalds@osdl.org">torvalds@osdl.org</ulink>&gt;</simpara>
</simplesect>
<simplesect id="_documentation">
<title>Documentation</title>
<simpara>Documentation by Junio C Hamano.</simpara>
</simplesect>
<simplesect id="_git">
<title>GIT</title>
<simpara>Part of the <xref linkend="git(1)"/> suite</simpara>
</simplesect>
</article>
