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