Documentation / git-remote.txton commit Merge branch 'maint-for-junio' of git://repo.or.cz/git/fastimport into maint (c2d4eb7)
   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] <name> <url>
  14'git-remote' show <name>
  15'git-remote' prune <name>
  16
  17DESCRIPTION
  18-----------
  19
  20Manage the set of repositories ("remotes") whose branches you track.
  21
  22
  23COMMANDS
  24--------
  25
  26With no arguments, shows a list of existing remotes.  Several
  27subcommands are available to perform operations on the remotes.
  28
  29'add'::
  30
  31Adds a remote named <name> for the repository at
  32<url>.  The command `git fetch <name>` can then be used to create and
  33update remote-tracking branches <name>/<branch>.
  34+
  35With `-f` option, `git fetch <name>` is run immediately after
  36the remote information is set up.
  37+
  38With `-t <branch>` option, instead of the default glob
  39refspec for the remote to track all branches under
  40`$GIT_DIR/remotes/<name>/`, a refspec to track only `<branch>`
  41is created.  You can give more than one `-t <branch>` to track
  42multiple branche without grabbing all branches.
  43+
  44With `-m <master>` option, `$GIT_DIR/remotes/<name>/HEAD` is set
  45up to point at remote's `<master>` branch instead of whatever
  46branch the `HEAD` at the remote repository actually points at.
  47
  48'show'::
  49
  50Gives some information about the remote <name>.
  51
  52'prune'::
  53
  54Deletes all stale tracking branches under <name>.
  55These stale branches have already been removed from the remote repository
  56referenced by <name>, but are still locally available in "remotes/<name>".
  57
  58
  59DISCUSSION
  60----------
  61
  62The remote configuration is achieved using the `remote.origin.url` and
  63`remote.origin.fetch` configuration variables.  (See
  64gitlink:git-config[1]).
  65
  66Examples
  67--------
  68
  69* Add a new remote, fetch, and check out a branch from it
  70+
  71------------
  72$ git remote
  73origin
  74$ git branch -r
  75origin/master
  76$ git remote add linux-nfs git://linux-nfs.org/pub/nfs-2.6.git
  77$ git remote
  78linux-nfs
  79origin
  80$ git fetch
  81* refs/remotes/linux-nfs/master: storing branch 'master' ...
  82  commit: bf81b46
  83$ git branch -r
  84origin/master
  85linux-nfs/master
  86$ git checkout -b nfs linux-nfs/master
  87...
  88------------
  89
  90* Imitate 'git clone' but track only selected branches
  91+
  92------------
  93$ mkdir project.git
  94$ cd project.git
  95$ git init
  96$ git remote add -f -t master -m master origin git://example.com/git.git/
  97$ git merge origin
  98------------
  99
 100
 101See Also
 102--------
 103gitlink:git-fetch[1]
 104gitlink:git-branch[1]
 105gitlink:git-config[1]
 106
 107Author
 108------
 109Written by Junio Hamano
 110
 111
 112Documentation
 113--------------
 114Documentation by J. Bruce Fields and the git-list <git@vger.kernel.org>.
 115
 116
 117GIT
 118---
 119Part of the gitlink:git[7] suite
 120