Documentation / git-remote.txton commit Merge branch 'master' into ph/strbuf (39bd2eb)
   1git-remote(1)
   2============
   3
   4NAME
   5----
   6git-remote - manage set of tracked repositories
   7
   8
   9SYNOPSIS
  10--------
  11[verse]
  12'git-remote'
  13'git-remote' add [-t <branch>] [-m <branch>] [-f] [--mirror] <name> <url>
  14'git-remote' show <name>
  15'git-remote' prune <name>
  16'git-remote' update [group]
  17
  18DESCRIPTION
  19-----------
  20
  21Manage the set of repositories ("remotes") whose branches you track.
  22
  23
  24COMMANDS
  25--------
  26
  27With no arguments, shows a list of existing remotes.  Several
  28subcommands are available to perform operations on the remotes.
  29
  30'add'::
  31
  32Adds a remote named <name> for the repository at
  33<url>.  The command `git fetch <name>` can then be used to create and
  34update remote-tracking branches <name>/<branch>.
  35+
  36With `-f` option, `git fetch <name>` is run immediately after
  37the remote information is set up.
  38+
  39With `-t <branch>` option, instead of the default glob
  40refspec for the remote to track all branches under
  41`$GIT_DIR/remotes/<name>/`, a refspec to track only `<branch>`
  42is created.  You can give more than one `-t <branch>` to track
  43multiple branches without grabbing all branches.
  44+
  45With `-m <master>` option, `$GIT_DIR/remotes/<name>/HEAD` is set
  46up to point at remote's `<master>` branch instead of whatever
  47branch the `HEAD` at the remote repository actually points at.
  48+
  49In mirror mode, enabled with `--mirror`, the refs will not be stored
  50in the 'refs/remotes/' namespace, but in 'refs/heads/'.  This option
  51only makes sense in bare repositories.
  52
  53'show'::
  54
  55Gives some information about the remote <name>.
  56+
  57With `-n` option, the remote heads are not queried first with
  58`git ls-remote <name>`; cached information is used instead.
  59
  60'prune'::
  61
  62Deletes all stale tracking branches under <name>.
  63These stale branches have already been removed from the remote repository
  64referenced by <name>, but are still locally available in
  65"remotes/<name>".
  66+
  67With `-n` option, the remote heads are not confirmed first with `git
  68ls-remote <name>`; cached information is used instead.  Use with
  69caution.
  70
  71'update'::
  72
  73Fetch updates for a named set of remotes in the repository as defined by
  74remotes.<group>.  If a named group is not specified on the command line,
  75the configuration parameter remotes.default will get used; if
  76remotes.default is not defined, all remotes which do not the
  77configuration parameter remote.<name>.skipDefaultUpdate set to true will
  78be updated.  (See gitlink:git-config[1]).
  79
  80
  81DISCUSSION
  82----------
  83
  84The remote configuration is achieved using the `remote.origin.url` and
  85`remote.origin.fetch` configuration variables.  (See
  86gitlink:git-config[1]).
  87
  88Examples
  89--------
  90
  91* Add a new remote, fetch, and check out a branch from it
  92+
  93------------
  94$ git remote
  95origin
  96$ git branch -r
  97origin/master
  98$ git remote add linux-nfs git://linux-nfs.org/pub/nfs-2.6.git
  99$ git remote
 100linux-nfs
 101origin
 102$ git fetch
 103* refs/remotes/linux-nfs/master: storing branch 'master' ...
 104  commit: bf81b46
 105$ git branch -r
 106origin/master
 107linux-nfs/master
 108$ git checkout -b nfs linux-nfs/master
 109...
 110------------
 111
 112* Imitate 'git clone' but track only selected branches
 113+
 114------------
 115$ mkdir project.git
 116$ cd project.git
 117$ git init
 118$ git remote add -f -t master -m master origin git://example.com/git.git/
 119$ git merge origin
 120------------
 121
 122
 123See Also
 124--------
 125gitlink:git-fetch[1]
 126gitlink:git-branch[1]
 127gitlink:git-config[1]
 128
 129Author
 130------
 131Written by Junio Hamano
 132
 133
 134Documentation
 135--------------
 136Documentation by J. Bruce Fields and the git-list <git@vger.kernel.org>.
 137
 138
 139GIT
 140---
 141Part of the gitlink:git[7] suite