<?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-remote(1)">
<articleinfo>
    <title>git-remote(1)</title>
        <indexterm>
                <primary>git-remote(1)</primary>
        </indexterm>
</articleinfo>
<simplesect id="_name">
<title>NAME</title>
<simpara>git-remote - manage set of tracked repositories</simpara>
</simplesect>
<simplesect id="_synopsis">
<title>SYNOPSIS</title>
<blockquote>
<literallayout><emphasis>git remote</emphasis> [-v | --verbose]
<emphasis>git remote add</emphasis> [-t &lt;branch&gt;] [-m &lt;master&gt;] [-f] [--mirror] &lt;name&gt; &lt;url&gt;
<emphasis>git remote rename</emphasis> &lt;old&gt; &lt;new&gt;
<emphasis>git remote rm</emphasis> &lt;name&gt;
<emphasis>git remote show</emphasis> [-n] &lt;name&gt;
<emphasis>git remote prune</emphasis> [-n | --dry-run] &lt;name&gt;
<emphasis>git remote update</emphasis> [group]</literallayout>
</blockquote>
</simplesect>
<simplesect id="_description">
<title>DESCRIPTION</title>
<simpara>Manage the set of repositories ("remotes") whose branches you track.</simpara>
</simplesect>
<simplesect id="_options">
<title>OPTIONS</title>
<variablelist>
<varlistentry>
<term>
-v
</term>
<term>
--verbose
</term>
<listitem>
<simpara>
        Be a little more verbose and show remote url after name.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</simplesect>
<simplesect id="_commands">
<title>COMMANDS</title>
<simpara>With no arguments, shows a list of existing remotes.  Several
subcommands are available to perform operations on the remotes.</simpara>
<variablelist>
<varlistentry>
<term>
<emphasis>add</emphasis>
</term>
<listitem>
<simpara>
Adds a remote named &lt;name&gt; for the repository at
&lt;url&gt;.  The command <literal>git fetch &lt;name&gt;</literal> can then be used to create and
update remote-tracking branches &lt;name&gt;/&lt;branch&gt;.
</simpara>
<simpara>With <literal>-f</literal> option, <literal>git fetch &lt;name&gt;</literal> is run immediately after
the remote information is set up.</simpara>
<simpara>With <literal>-t &lt;branch&gt;</literal> option, instead of the default glob
refspec for the remote to track all branches under
<literal>$GIT_DIR/remotes/&lt;name&gt;/</literal>, a refspec to track only <literal>&lt;branch&gt;</literal>
is created.  You can give more than one <literal>-t &lt;branch&gt;</literal> to track
multiple branches without grabbing all branches.</simpara>
<simpara>With <literal>-m &lt;master&gt;</literal> option, <literal>$GIT_DIR/remotes/&lt;name&gt;/HEAD</literal> is set
up to point at remote&#8217;s <literal>&lt;master&gt;</literal> branch instead of whatever
branch the <literal>HEAD</literal> at the remote repository actually points at.</simpara>
<simpara>In mirror mode, enabled with <literal>--mirror</literal>, the refs will not be stored
in the <emphasis>refs/remotes/</emphasis> namespace, but in <emphasis>refs/heads/</emphasis>.  This option
only makes sense in bare repositories.  If a remote uses mirror
mode, furthermore, <literal>git push</literal> will always behave as if <literal>--mirror</literal>
was passed.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>rename</emphasis>
</term>
<listitem>
<simpara>
Rename the remote named &lt;old&gt; to &lt;new&gt;. All remote tracking branches and
configuration settings for the remote are updated.
</simpara>
<simpara>In case &lt;old&gt; and &lt;new&gt; are the same, and &lt;old&gt; is a file under
<literal>$GIT_DIR/remotes</literal> or <literal>$GIT_DIR/branches</literal>, the remote is converted to
the configuration file format.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>rm</emphasis>
</term>
<listitem>
<simpara>
Remove the remote named &lt;name&gt;. All remote tracking branches and
configuration settings for the remote are removed.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>show</emphasis>
</term>
<listitem>
<simpara>
Gives some information about the remote &lt;name&gt;.
</simpara>
<simpara>With <literal>-n</literal> option, the remote heads are not queried first with
<literal>git ls-remote &lt;name&gt;</literal>; cached information is used instead.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>prune</emphasis>
</term>
<listitem>
<simpara>
Deletes all stale tracking branches under &lt;name&gt;.
These stale branches have already been removed from the remote repository
referenced by &lt;name&gt;, but are still locally available in
"remotes/&lt;name&gt;".
</simpara>
<simpara>With <literal>--dry-run</literal> option, report what branches will be pruned, but do no
actually prune them.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>update</emphasis>
</term>
<listitem>
<simpara>
Fetch updates for a named set of remotes in the repository as defined by
remotes.&lt;group&gt;.  If a named group is not specified on the command line,
the configuration parameter remotes.default will get used; if
remotes.default is not defined, all remotes which do not have the
configuration parameter remote.&lt;name&gt;.skipDefaultUpdate set to true will
be updated.  (See <xref linkend="git-config(1)"/>).
</simpara>
</listitem>
</varlistentry>
</variablelist>
</simplesect>
<simplesect id="_discussion">
<title>DISCUSSION</title>
<simpara>The remote configuration is achieved using the <literal>remote.origin.url</literal> and
<literal>remote.origin.fetch</literal> configuration variables.  (See
<xref linkend="git-config(1)"/>).</simpara>
</simplesect>
<simplesect id="_examples">
<title>Examples</title>
<itemizedlist>
<listitem>
<simpara>
Add a new remote, fetch, and check out a branch from it
</simpara>
<literallayout>$ git remote
origin
$ git branch -r
origin/master
$ git remote add linux-nfs git://linux-nfs.org/pub/linux/nfs-2.6.git
$ git remote
linux-nfs
origin
$ git fetch
* refs/remotes/linux-nfs/master: storing branch 'master' ...
  commit: bf81b46
$ git branch -r
origin/master
linux-nfs/master
$ git checkout -b nfs linux-nfs/master
...</literallayout>
</listitem>
<listitem>
<simpara>
Imitate <emphasis>git-clone</emphasis> but track only selected branches
</simpara>
<literallayout>$ mkdir project.git
$ cd project.git
$ git init
$ git remote add -f -t master -m master origin git://example.com/git.git/
$ git merge origin</literallayout>
</listitem>
</itemizedlist>
</simplesect>
<simplesect id="_see_also">
<title>SEE ALSO</title>
<simpara><xref linkend="git-fetch(1)"/>
<xref linkend="git-branch(1)"/>
<xref linkend="git-config(1)"/></simpara>
</simplesect>
<simplesect id="_author">
<title>Author</title>
<simpara>Written by Junio Hamano</simpara>
</simplesect>
<simplesect id="_documentation">
<title>Documentation</title>
<simpara>Documentation by J. Bruce Fields and the git-list &lt;<ulink url="mailto:git@vger.kernel.org">git@vger.kernel.org</ulink>&gt;.</simpara>
</simplesect>
<simplesect id="_git">
<title>GIT</title>
<simpara>Part of the <xref linkend="git(1)"/> suite</simpara>
</simplesect>
</article>
