blob: e8c396b5f92903777ce5905cf52e2ef879850739 [file] [log] [blame]
Junio C Hamano1d3a6c72007-01-09 11:13:471git-remote(1)
2============
3
4NAME
5----
6git-remote - manage set of tracked repositories
7
8
9SYNOPSIS
10--------
11[verse]
Junio C Hamanofce7c7e2008-07-02 03:06:3812'git remote' [-v | --verbose]
Junio C Hamanoee3adc32011-04-06 19:53:3813'git remote add' [-t <branch>] [-m <master>] [-f] [--tags|--no-tags] [--mirror=<fetch|push>] <name> <url>
Junio C Hamano28363492008-11-14 08:26:3114'git remote rename' <old> <new>
Junio C Hamano693e7092012-09-12 22:56:5315'git remote remove' <name>
Junio C Hamanobf984de2009-11-23 06:11:1916'git remote set-head' <name> (-a | -d | <branch>)
Junio C Hamanoe0238c22012-02-23 22:45:5017'git remote set-branches' [--add] <name> <branch>...
Junio C Hamano57827fb2010-01-23 03:02:5018'git remote set-url' [--push] <name> <newurl> [<oldurl>]
19'git remote set-url --add' [--push] <name> <newurl>
20'git remote set-url --delete' [--push] <name> <url>
Junio C Hamanobf984de2009-11-23 06:11:1921'git remote' [-v | --verbose] 'show' [-n] <name>
Junio C Hamanoba4b9282008-07-06 05:20:3122'git remote prune' [-n | --dry-run] <name>
Junio C Hamanod2179ef2010-10-22 04:12:1723'git remote' [-v | --verbose] 'update' [-p | --prune] [(<group> | <remote>)...]
Junio C Hamano1d3a6c72007-01-09 11:13:4724
25DESCRIPTION
26-----------
27
28Manage the set of repositories ("remotes") whose branches you track.
29
Junio C Hamano1d3a6c72007-01-09 11:13:4730
Junio C Hamanoeb415992008-06-08 22:49:4731OPTIONS
32-------
33
34-v::
35--verbose::
36Be a little more verbose and show remote url after name.
Junio C Hamanobf984de2009-11-23 06:11:1937NOTE: This must be placed between `remote` and `subcommand`.
Junio C Hamanoeb415992008-06-08 22:49:4738
39
Junio C Hamanoee1e4282007-02-04 08:32:0440COMMANDS
41--------
42
43With no arguments, shows a list of existing remotes. Several
44subcommands are available to perform operations on the remotes.
45
46'add'::
47
48Adds a remote named <name> for the repository at
Junio C Hamano1d3a6c72007-01-09 11:13:4749<url>. The command `git fetch <name>` can then be used to create and
50update remote-tracking branches <name>/<branch>.
Junio C Hamano17dde0e2007-02-26 09:50:2151+
52With `-f` option, `git fetch <name>` is run immediately after
53the remote information is set up.
54+
Junio C Hamanocc7636a2010-05-21 14:57:5355With `--tags` option, `git fetch <name>` imports every tag from the
56remote repository.
57+
58With `--no-tags` option, `git fetch <name>` does not import tags from
59the remote repository.
60+
Junio C Hamano17dde0e2007-02-26 09:50:2161With `-t <branch>` option, instead of the default glob
62refspec for the remote to track all branches under
Junio C Hamano360e3a12011-07-13 23:51:5663the `refs/remotes/<name>/` namespace, a refspec to track only `<branch>`
Junio C Hamano17dde0e2007-02-26 09:50:2164is created. You can give more than one `-t <branch>` to track
Junio C Hamano67fad6d2007-05-06 08:53:1265multiple branches without grabbing all branches.
Junio C Hamano17dde0e2007-02-26 09:50:2166+
Junio C Hamano360e3a12011-07-13 23:51:5667With `-m <master>` option, a symbolic-ref `refs/remotes/<name>/HEAD` is set
Junio C Hamanod257cff2009-03-18 05:27:1668up to point at remote's `<master>` branch. See also the set-head command.
Junio C Hamano58155b42007-09-15 07:46:1469+
Junio C Hamanob76a6862012-05-02 22:02:4670When a fetch mirror is created with `--mirror=fetch`, the refs will not
Junio C Hamanoee3adc32011-04-06 19:53:3871be stored in the 'refs/remotes/' namespace, but rather everything in
72'refs/' on the remote will be directly mirrored into 'refs/' in the
73local repository. This option only makes sense in bare repositories,
74because a fetch would overwrite any local commits.
75+
Junio C Hamanob76a6862012-05-02 22:02:4676When a push mirror is created with `--mirror=push`, then `git push`
77will always behave as if `--mirror` was passed.
Junio C Hamano1d3a6c72007-01-09 11:13:4778
Junio C Hamano28363492008-11-14 08:26:3179'rename'::
80
Junio C Hamano97bcb482010-11-25 03:16:0781Rename the remote named <old> to <new>. All remote-tracking branches and
Junio C Hamano28363492008-11-14 08:26:3182configuration settings for the remote are updated.
83+
84In case <old> and <new> are the same, and <old> is a file under
85`$GIT_DIR/remotes` or `$GIT_DIR/branches`, the remote is converted to
86the configuration file format.
87
Junio C Hamano693e7092012-09-12 22:56:5388'remove'::
Junio C Hamano4fd58d42007-09-30 00:51:1489'rm'::
90
Junio C Hamano97bcb482010-11-25 03:16:0791Remove the remote named <name>. All remote-tracking branches and
Junio C Hamano4fd58d42007-09-30 00:51:1492configuration settings for the remote are removed.
93
Junio C Hamanod257cff2009-03-18 05:27:1694'set-head'::
95
Junio C Hamano360e3a12011-07-13 23:51:5696Sets or deletes the default branch (i.e. the target of the
97symbolic-ref `refs/remotes/<name>/HEAD`) for
Junio C Hamanod257cff2009-03-18 05:27:1698the named remote. Having a default branch for a remote is not required,
99but allows the name of the remote to be specified in lieu of a specific
100branch. For example, if the default branch for `origin` is set to
101`master`, then `origin` may be specified wherever you would normally
102specify `origin/master`.
103+
Junio C Hamano360e3a12011-07-13 23:51:56104With `-d`, the symbolic ref `refs/remotes/<name>/HEAD` is deleted.
Junio C Hamanod257cff2009-03-18 05:27:16105+
Junio C Hamano360e3a12011-07-13 23:51:56106With `-a`, the remote is queried to determine its `HEAD`, then the
107symbolic-ref `refs/remotes/<name>/HEAD` is set to the same branch. e.g., if the remote
Junio C Hamanod257cff2009-03-18 05:27:16108`HEAD` is pointed at `next`, "`git remote set-head origin -a`" will set
Junio C Hamano360e3a12011-07-13 23:51:56109the symbolic-ref `refs/remotes/origin/HEAD` to `refs/remotes/origin/next`. This will
Junio C Hamanod257cff2009-03-18 05:27:16110only work if `refs/remotes/origin/next` already exists; if not it must be
111fetched first.
112+
Junio C Hamano360e3a12011-07-13 23:51:56113Use `<branch>` to set the symbolic-ref `refs/remotes/<name>/HEAD` explicitly. e.g., "git
114remote set-head origin master" will set the symbolic-ref `refs/remotes/origin/HEAD` to
Junio C Hamanod257cff2009-03-18 05:27:16115`refs/remotes/origin/master`. This will only work if
116`refs/remotes/origin/master` already exists; if not it must be fetched first.
117+
118
Junio C Hamanof5de4cf2010-06-19 00:33:17119'set-branches'::
120
121Changes the list of branches tracked by the named remote.
122This can be used to track a subset of the available remote branches
123after the initial setup for a remote.
124+
125The named branches will be interpreted as if specified with the
126`-t` option on the 'git remote add' command line.
127+
128With `--add`, instead of replacing the list of currently tracked
129branches, adds to that list.
130
Junio C Hamano57827fb2010-01-23 03:02:50131'set-url'::
132
133Changes URL remote points to. Sets first URL remote points to matching
134regex <oldurl> (first URL if no <oldurl> is given) to <newurl>. If
135<oldurl> doesn't match any URL, error occurs and nothing is changed.
136+
137With '--push', push URLs are manipulated instead of fetch URLs.
138+
139With '--add', instead of changing some URL, new URL is added.
140+
141With '--delete', instead of changing some URL, all URLs matching
142regex <url> are deleted. Trying to delete all non-push URLs is an
143error.
144
Junio C Hamanoee1e4282007-02-04 08:32:04145'show'::
Junio C Hamano1d3a6c72007-01-09 11:13:47146
Junio C Hamanoee1e4282007-02-04 08:32:04147Gives some information about the remote <name>.
Junio C Hamano401939f2007-07-01 06:34:30148+
149With `-n` option, the remote heads are not queried first with
150`git ls-remote <name>`; cached information is used instead.
Junio C Hamanoee1e4282007-02-04 08:32:04151
152'prune'::
153
Junio C Hamano97bcb482010-11-25 03:16:07154Deletes all stale remote-tracking branches under <name>.
Junio C Hamano39381a72007-02-02 07:35:15155These stale branches have already been removed from the remote repository
Junio C Hamano0bbd4672007-02-20 04:52:14156referenced by <name>, but are still locally available in
157"remotes/<name>".
Junio C Hamano401939f2007-07-01 06:34:30158+
Junio C Hamano9f883862009-08-11 06:23:52159With `--dry-run` option, report what branches will be pruned, but do not
Junio C Hamano6fb124c2008-06-13 10:04:01160actually prune them.
Junio C Hamano0bbd4672007-02-20 04:52:14161
162'update'::
163
Junio C Hamano118d2772007-02-21 20:24:10164Fetch updates for a named set of remotes in the repository as defined by
165remotes.<group>. If a named group is not specified on the command line,
Junio C Hamano9f883862009-08-11 06:23:52166the configuration parameter remotes.default will be used; if
Junio C Hamano361c1332007-11-14 12:17:22167remotes.default is not defined, all remotes which do not have the
Junio C Hamano118d2772007-02-21 20:24:10168configuration parameter remote.<name>.skipDefaultUpdate set to true will
Junio C Hamano35738e82008-01-07 07:55:46169be updated. (See linkgit:git-config[1]).
Junio C Hamano98e32c32009-04-13 02:39:53170+
171With `--prune` option, prune all the remotes that are updated.
Junio C Hamano39381a72007-02-02 07:35:15172
Junio C Hamanoee1e4282007-02-04 08:32:04173
174DISCUSSION
175----------
176
Junio C Hamano1d3a6c72007-01-09 11:13:47177The remote configuration is achieved using the `remote.origin.url` and
178`remote.origin.fetch` configuration variables. (See
Junio C Hamano35738e82008-01-07 07:55:46179linkgit:git-config[1]).
Junio C Hamano1d3a6c72007-01-09 11:13:47180
181Examples
182--------
183
Junio C Hamano6ac2f142007-03-01 01:24:56184* Add a new remote, fetch, and check out a branch from it
185+
Junio C Hamano1d3a6c72007-01-09 11:13:47186------------
187$ git remote
188origin
189$ git branch -r
190origin/master
Junio C Hamano393e57f2007-11-20 04:53:25191$ git remote add linux-nfs git://linux-nfs.org/pub/linux/nfs-2.6.git
Junio C Hamano1d3a6c72007-01-09 11:13:47192$ git remote
193linux-nfs
194origin
195$ git fetch
196* refs/remotes/linux-nfs/master: storing branch 'master' ...
197 commit: bf81b46
198$ git branch -r
199origin/master
200linux-nfs/master
201$ git checkout -b nfs linux-nfs/master
202...
203------------
204
Junio C Hamano1aa40d22010-01-21 17:46:43205* Imitate 'git clone' but track only selected branches
Junio C Hamano6ac2f142007-03-01 01:24:56206+
207------------
208$ mkdir project.git
209$ cd project.git
210$ git init
211$ git remote add -f -t master -m master origin git://example.com/git.git/
212$ git merge origin
213------------
214
215
Junio C Hamano9049d912008-05-29 02:09:50216SEE ALSO
Junio C Hamano1d3a6c72007-01-09 11:13:47217--------
Junio C Hamano35738e82008-01-07 07:55:46218linkgit:git-fetch[1]
219linkgit:git-branch[1]
220linkgit:git-config[1]
Junio C Hamano1d3a6c72007-01-09 11:13:47221
Junio C Hamano1d3a6c72007-01-09 11:13:47222GIT
223---
Junio C Hamanof7c042d2008-06-06 22:50:53224Part of the linkgit:git[1] suite