Documentation / git-remote.txton commit userdiff: add Octave (91bf382)
   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] [--[no-]tags] [--mirror=<fetch|push>] <name> <url>
  14'git remote rename' <old> <new>
  15'git remote remove' <name>
  16'git remote set-head' <name> (-a | --auto | -d | --delete | <branch>)
  17'git remote set-branches' [--add] <name> <branch>...
  18'git remote get-url' [--push] [--all] <name>
  19'git remote set-url' [--push] <name> <newurl> [<oldurl>]
  20'git remote set-url --add' [--push] <name> <newurl>
  21'git remote set-url --delete' [--push] <name> <url>
  22'git remote' [-v | --verbose] 'show' [-n] <name>...
  23'git remote prune' [-n | --dry-run] <name>...
  24'git remote' [-v | --verbose] 'update' [-p | --prune] [(<group> | <remote>)...]
  25
  26DESCRIPTION
  27-----------
  28
  29Manage the set of repositories ("remotes") whose branches you track.
  30
  31
  32OPTIONS
  33-------
  34
  35-v::
  36--verbose::
  37        Be a little more verbose and show remote url after name.
  38        NOTE: This must be placed between `remote` and `subcommand`.
  39
  40
  41COMMANDS
  42--------
  43
  44With no arguments, shows a list of existing remotes.  Several
  45subcommands are available to perform operations on the remotes.
  46
  47'add'::
  48
  49Adds a remote named <name> for the repository at
  50<url>.  The command `git fetch <name>` can then be used to create and
  51update remote-tracking branches <name>/<branch>.
  52+
  53With `-f` option, `git fetch <name>` is run immediately after
  54the remote information is set up.
  55+
  56With `--tags` option, `git fetch <name>` imports every tag from the
  57remote repository.
  58+
  59With `--no-tags` option, `git fetch <name>` does not import tags from
  60the remote repository.
  61+
  62By default, only tags on fetched branches are imported
  63(see linkgit:git-fetch[1]).
  64+
  65With `-t <branch>` option, instead of the default glob
  66refspec for the remote to track all branches under
  67the `refs/remotes/<name>/` namespace, a refspec to track only `<branch>`
  68is created.  You can give more than one `-t <branch>` to track
  69multiple branches without grabbing all branches.
  70+
  71With `-m <master>` option, a symbolic-ref `refs/remotes/<name>/HEAD` is set
  72up to point at remote's `<master>` branch. See also the set-head command.
  73+
  74When a fetch mirror is created with `--mirror=fetch`, the refs will not
  75be stored in the 'refs/remotes/' namespace, but rather everything in
  76'refs/' on the remote will be directly mirrored into 'refs/' in the
  77local repository. This option only makes sense in bare repositories,
  78because a fetch would overwrite any local commits.
  79+
  80When a push mirror is created with `--mirror=push`, then `git push`
  81will always behave as if `--mirror` was passed.
  82
  83'rename'::
  84
  85Rename the remote named <old> to <new>. All remote-tracking branches and
  86configuration settings for the remote are updated.
  87+
  88In case <old> and <new> are the same, and <old> is a file under
  89`$GIT_DIR/remotes` or `$GIT_DIR/branches`, the remote is converted to
  90the configuration file format.
  91
  92'remove'::
  93'rm'::
  94
  95Remove the remote named <name>. All remote-tracking branches and
  96configuration settings for the remote are removed.
  97
  98'set-head'::
  99
 100Sets or deletes the default branch (i.e. the target of the
 101symbolic-ref `refs/remotes/<name>/HEAD`) for
 102the named remote. Having a default branch for a remote is not required,
 103but allows the name of the remote to be specified in lieu of a specific
 104branch. For example, if the default branch for `origin` is set to
 105`master`, then `origin` may be specified wherever you would normally
 106specify `origin/master`.
 107+
 108With `-d` or `--delete`, the symbolic ref `refs/remotes/<name>/HEAD` is deleted.
 109+
 110With `-a` or `--auto`, the remote is queried to determine its `HEAD`, then the
 111symbolic-ref `refs/remotes/<name>/HEAD` is set to the same branch. e.g., if the remote
 112`HEAD` is pointed at `next`, "`git remote set-head origin -a`" will set
 113the symbolic-ref `refs/remotes/origin/HEAD` to `refs/remotes/origin/next`. This will
 114only work if `refs/remotes/origin/next` already exists; if not it must be
 115fetched first.
 116+
 117Use `<branch>` to set the symbolic-ref `refs/remotes/<name>/HEAD` explicitly. e.g., "git
 118remote set-head origin master" will set the symbolic-ref `refs/remotes/origin/HEAD` to
 119`refs/remotes/origin/master`. This will only work if
 120`refs/remotes/origin/master` already exists; if not it must be fetched first.
 121+
 122
 123'set-branches'::
 124
 125Changes the list of branches tracked by the named remote.
 126This can be used to track a subset of the available remote branches
 127after the initial setup for a remote.
 128+
 129The named branches will be interpreted as if specified with the
 130`-t` option on the 'git remote add' command line.
 131+
 132With `--add`, instead of replacing the list of currently tracked
 133branches, adds to that list.
 134
 135'get-url'::
 136
 137Retrieves the URLs for a remote. Configurations for `insteadOf` and
 138`pushInsteadOf` are expanded here. By default, only the first URL is listed.
 139+
 140With `--push`, push URLs are queried rather than fetch URLs.
 141+
 142With `--all`, all URLs for the remote will be listed.
 143
 144'set-url'::
 145
 146Changes URLs for the remote. Sets first URL for remote <name> that matches
 147regex <oldurl> (first URL if no <oldurl> is given) to <newurl>. If
 148<oldurl> doesn't match any URL, an error occurs and nothing is changed.
 149+
 150With `--push`, push URLs are manipulated instead of fetch URLs.
 151+
 152With `--add`, instead of changing existing URLs, new URL is added.
 153+
 154With `--delete`, instead of changing existing URLs, all URLs matching
 155regex <url> are deleted for remote <name>.  Trying to delete all
 156non-push URLs is an error.
 157+
 158Note that the push URL and the fetch URL, even though they can
 159be set differently, must still refer to the same place.  What you
 160pushed to the push URL should be what you would see if you
 161immediately fetched from the fetch URL.  If you are trying to
 162fetch from one place (e.g. your upstream) and push to another (e.g.
 163your publishing repository), use two separate remotes.
 164
 165
 166'show'::
 167
 168Gives some information about the remote <name>.
 169+
 170With `-n` option, the remote heads are not queried first with
 171`git ls-remote <name>`; cached information is used instead.
 172
 173'prune'::
 174
 175Deletes stale references associated with <name>. By default, stale
 176remote-tracking branches under <name> are deleted, but depending on
 177global configuration and the configuration of the remote we might even
 178prune local tags that haven't been pushed there. Equivalent to `git
 179fetch --prune <name>`, except that no new references will be fetched.
 180+
 181See the PRUNING section of linkgit:git-fetch[1] for what it'll prune
 182depending on various configuration.
 183+
 184With `--dry-run` option, report what branches will be pruned, but do not
 185actually prune them.
 186
 187'update'::
 188
 189Fetch updates for remotes or remote groups in the repository as defined by
 190remotes.<group>.  If neither group nor remote is specified on the command line,
 191the configuration parameter remotes.default will be used; if
 192remotes.default is not defined, all remotes which do not have the
 193configuration parameter remote.<name>.skipDefaultUpdate set to true will
 194be updated.  (See linkgit:git-config[1]).
 195+
 196With `--prune` option, run pruning against all the remotes that are updated.
 197
 198
 199DISCUSSION
 200----------
 201
 202The remote configuration is achieved using the `remote.origin.url` and
 203`remote.origin.fetch` configuration variables.  (See
 204linkgit:git-config[1]).
 205
 206EXAMPLES
 207--------
 208
 209* Add a new remote, fetch, and check out a branch from it
 210+
 211------------
 212$ git remote
 213origin
 214$ git branch -r
 215  origin/HEAD -> origin/master
 216  origin/master
 217$ git remote add staging git://git.kernel.org/.../gregkh/staging.git
 218$ git remote
 219origin
 220staging
 221$ git fetch staging
 222...
 223From git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
 224 * [new branch]      master     -> staging/master
 225 * [new branch]      staging-linus -> staging/staging-linus
 226 * [new branch]      staging-next -> staging/staging-next
 227$ git branch -r
 228  origin/HEAD -> origin/master
 229  origin/master
 230  staging/master
 231  staging/staging-linus
 232  staging/staging-next
 233$ git checkout -b staging staging/master
 234...
 235------------
 236
 237* Imitate 'git clone' but track only selected branches
 238+
 239------------
 240$ mkdir project.git
 241$ cd project.git
 242$ git init
 243$ git remote add -f -t master -m master origin git://example.com/git.git/
 244$ git merge origin
 245------------
 246
 247
 248SEE ALSO
 249--------
 250linkgit:git-fetch[1]
 251linkgit:git-branch[1]
 252linkgit:git-config[1]
 253
 254GIT
 255---
 256Part of the linkgit:git[1] suite