Documentation / git-remote.txton commit remote-helpers: add tests for testgit helper (2cb5a48)
   1git-remote(1)
   2============
   3
   4NAME
   5----
   6git-remote - manage set of tracked repositories
   7
   8
   9SYNOPSIS
  10--------
  11[verse]
  12'git remote' [-v | --verbose]
  13'git remote add' [-t <branch>] [-m <master>] [-f] [--mirror] <name> <url>
  14'git remote rename' <old> <new>
  15'git remote rm' <name>
  16'git remote set-head' <name> (-a | -d | <branch>)
  17'git remote set-url' [--push] <name> <newurl> [<oldurl>]
  18'git remote set-url --add' [--push] <name> <newurl>
  19'git remote set-url --delete' [--push] <name> <url>
  20'git remote' [-v | --verbose] 'show' [-n] <name>
  21'git remote prune' [-n | --dry-run] <name>
  22'git remote' [-v | --verbose] 'update' [-p | --prune] [group | remote]...
  23
  24DESCRIPTION
  25-----------
  26
  27Manage the set of repositories ("remotes") whose branches you track.
  28
  29
  30OPTIONS
  31-------
  32
  33-v::
  34--verbose::
  35        Be a little more verbose and show remote url after name.
  36        NOTE: This must be placed between `remote` and `subcommand`.
  37
  38
  39COMMANDS
  40--------
  41
  42With no arguments, shows a list of existing remotes.  Several
  43subcommands are available to perform operations on the remotes.
  44
  45'add'::
  46
  47Adds a remote named <name> for the repository at
  48<url>.  The command `git fetch <name>` can then be used to create and
  49update remote-tracking branches <name>/<branch>.
  50+
  51With `-f` option, `git fetch <name>` is run immediately after
  52the remote information is set up.
  53+
  54With `-t <branch>` option, instead of the default glob
  55refspec for the remote to track all branches under
  56`$GIT_DIR/remotes/<name>/`, a refspec to track only `<branch>`
  57is created.  You can give more than one `-t <branch>` to track
  58multiple branches without grabbing all branches.
  59+
  60With `-m <master>` option, `$GIT_DIR/remotes/<name>/HEAD` is set
  61up to point at remote's `<master>` branch. See also the set-head command.
  62+
  63In mirror mode, enabled with `\--mirror`, the refs will not be stored
  64in the 'refs/remotes/' namespace, but in 'refs/heads/'.  This option
  65only makes sense in bare repositories.  If a remote uses mirror
  66mode, furthermore, `git push` will always behave as if `\--mirror`
  67was passed.
  68
  69'rename'::
  70
  71Rename the remote named <old> to <new>. All remote tracking branches and
  72configuration settings for the remote are updated.
  73+
  74In case <old> and <new> are the same, and <old> is a file under
  75`$GIT_DIR/remotes` or `$GIT_DIR/branches`, the remote is converted to
  76the configuration file format.
  77
  78'rm'::
  79
  80Remove the remote named <name>. All remote tracking branches and
  81configuration settings for the remote are removed.
  82
  83'set-head'::
  84
  85Sets or deletes the default branch (`$GIT_DIR/remotes/<name>/HEAD`) for
  86the named remote. Having a default branch for a remote is not required,
  87but allows the name of the remote to be specified in lieu of a specific
  88branch. For example, if the default branch for `origin` is set to
  89`master`, then `origin` may be specified wherever you would normally
  90specify `origin/master`.
  91+
  92With `-d`, `$GIT_DIR/remotes/<name>/HEAD` is deleted.
  93+
  94With `-a`, the remote is queried to determine its `HEAD`, then
  95`$GIT_DIR/remotes/<name>/HEAD` is set to the same branch. e.g., if the remote
  96`HEAD` is pointed at `next`, "`git remote set-head origin -a`" will set
  97`$GIT_DIR/refs/remotes/origin/HEAD` to `refs/remotes/origin/next`. This will
  98only work if `refs/remotes/origin/next` already exists; if not it must be
  99fetched first.
 100+
 101Use `<branch>` to set `$GIT_DIR/remotes/<name>/HEAD` explicitly. e.g., "git
 102remote set-head origin master" will set `$GIT_DIR/refs/remotes/origin/HEAD` to
 103`refs/remotes/origin/master`. This will only work if
 104`refs/remotes/origin/master` already exists; if not it must be fetched first.
 105+
 106
 107'set-url'::
 108
 109Changes URL remote points to. Sets first URL remote points to matching
 110regex <oldurl> (first URL if no <oldurl> is given) to <newurl>. If
 111<oldurl> doesn't match any URL, error occurs and nothing is changed.
 112+
 113With '--push', push URLs are manipulated instead of fetch URLs.
 114+
 115With '--add', instead of changing some URL, new URL is added.
 116+
 117With '--delete', instead of changing some URL, all URLs matching
 118regex <url> are deleted. Trying to delete all non-push URLs is an
 119error.
 120
 121'show'::
 122
 123Gives some information about the remote <name>.
 124+
 125With `-n` option, the remote heads are not queried first with
 126`git ls-remote <name>`; cached information is used instead.
 127
 128'prune'::
 129
 130Deletes all stale tracking branches under <name>.
 131These stale branches have already been removed from the remote repository
 132referenced by <name>, but are still locally available in
 133"remotes/<name>".
 134+
 135With `--dry-run` option, report what branches will be pruned, but do not
 136actually prune them.
 137
 138'update'::
 139
 140Fetch updates for a named set of remotes in the repository as defined by
 141remotes.<group>.  If a named group is not specified on the command line,
 142the configuration parameter remotes.default will be used; if
 143remotes.default is not defined, all remotes which do not have the
 144configuration parameter remote.<name>.skipDefaultUpdate set to true will
 145be updated.  (See linkgit:git-config[1]).
 146+
 147With `--prune` option, prune all the remotes that are updated.
 148
 149
 150DISCUSSION
 151----------
 152
 153The remote configuration is achieved using the `remote.origin.url` and
 154`remote.origin.fetch` configuration variables.  (See
 155linkgit:git-config[1]).
 156
 157Examples
 158--------
 159
 160* Add a new remote, fetch, and check out a branch from it
 161+
 162------------
 163$ git remote
 164origin
 165$ git branch -r
 166origin/master
 167$ git remote add linux-nfs git://linux-nfs.org/pub/linux/nfs-2.6.git
 168$ git remote
 169linux-nfs
 170origin
 171$ git fetch
 172* refs/remotes/linux-nfs/master: storing branch 'master' ...
 173  commit: bf81b46
 174$ git branch -r
 175origin/master
 176linux-nfs/master
 177$ git checkout -b nfs linux-nfs/master
 178...
 179------------
 180
 181* Imitate 'git clone' but track only selected branches
 182+
 183------------
 184$ mkdir project.git
 185$ cd project.git
 186$ git init
 187$ git remote add -f -t master -m master origin git://example.com/git.git/
 188$ git merge origin
 189------------
 190
 191
 192SEE ALSO
 193--------
 194linkgit:git-fetch[1]
 195linkgit:git-branch[1]
 196linkgit:git-config[1]
 197
 198Author
 199------
 200Written by Junio Hamano
 201
 202
 203Documentation
 204--------------
 205Documentation by J. Bruce Fields and the git-list <git@vger.kernel.org>.
 206
 207
 208GIT
 209---
 210Part of the linkgit:git[1] suite