Junio C Hamano | 1d3a6c7 | 2007-01-09 11:13:47 | [diff] [blame] | 1 | git-remote(1) |
| 2 | ============ |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| 6 | git-remote - manage set of tracked repositories |
| 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
| 11 | [verse] |
| 12 | 'git-remote' |
Junio C Hamano | 6ac2f14 | 2007-03-01 01:24:56 | [diff] [blame] | 13 | 'git-remote' add [-t <branch>] [-m <branch>] [-f] <name> <url> |
Junio C Hamano | 1d3a6c7 | 2007-01-09 11:13:47 | [diff] [blame] | 14 | 'git-remote' show <name> |
Junio C Hamano | 39381a7 | 2007-02-02 07:35:15 | [diff] [blame] | 15 | 'git-remote' prune <name> |
Junio C Hamano | 118d277 | 2007-02-21 20:24:10 | [diff] [blame] | 16 | 'git-remote' update [group] |
Junio C Hamano | 1d3a6c7 | 2007-01-09 11:13:47 | [diff] [blame] | 17 | |
| 18 | DESCRIPTION |
| 19 | ----------- |
| 20 | |
| 21 | Manage the set of repositories ("remotes") whose branches you track. |
| 22 | |
Junio C Hamano | 1d3a6c7 | 2007-01-09 11:13:47 | [diff] [blame] | 23 | |
Junio C Hamano | ee1e428 | 2007-02-04 08:32:04 | [diff] [blame] | 24 | COMMANDS |
| 25 | -------- |
| 26 | |
| 27 | With no arguments, shows a list of existing remotes. Several |
| 28 | subcommands are available to perform operations on the remotes. |
| 29 | |
| 30 | 'add':: |
| 31 | |
| 32 | Adds a remote named <name> for the repository at |
Junio C Hamano | 1d3a6c7 | 2007-01-09 11:13:47 | [diff] [blame] | 33 | <url>. The command `git fetch <name>` can then be used to create and |
| 34 | update remote-tracking branches <name>/<branch>. |
Junio C Hamano | 17dde0e | 2007-02-26 09:50:21 | [diff] [blame] | 35 | + |
| 36 | With `-f` option, `git fetch <name>` is run immediately after |
| 37 | the remote information is set up. |
| 38 | + |
| 39 | With `-t <branch>` option, instead of the default glob |
| 40 | refspec for the remote to track all branches under |
| 41 | `$GIT_DIR/remotes/<name>/`, a refspec to track only `<branch>` |
| 42 | is created. You can give more than one `-t <branch>` to track |
Junio C Hamano | 67fad6d | 2007-05-06 08:53:12 | [diff] [blame] | 43 | multiple branches without grabbing all branches. |
Junio C Hamano | 17dde0e | 2007-02-26 09:50:21 | [diff] [blame] | 44 | + |
| 45 | With `-m <master>` option, `$GIT_DIR/remotes/<name>/HEAD` is set |
| 46 | up to point at remote's `<master>` branch instead of whatever |
| 47 | branch the `HEAD` at the remote repository actually points at. |
Junio C Hamano | 1d3a6c7 | 2007-01-09 11:13:47 | [diff] [blame] | 48 | |
Junio C Hamano | ee1e428 | 2007-02-04 08:32:04 | [diff] [blame] | 49 | 'show':: |
Junio C Hamano | 1d3a6c7 | 2007-01-09 11:13:47 | [diff] [blame] | 50 | |
Junio C Hamano | ee1e428 | 2007-02-04 08:32:04 | [diff] [blame] | 51 | Gives some information about the remote <name>. |
Junio C Hamano | 401939f | 2007-07-01 06:34:30 | [diff] [blame] | 52 | + |
| 53 | With `-n` option, the remote heads are not queried first with |
| 54 | `git ls-remote <name>`; cached information is used instead. |
Junio C Hamano | ee1e428 | 2007-02-04 08:32:04 | [diff] [blame] | 55 | |
| 56 | 'prune':: |
| 57 | |
| 58 | Deletes all stale tracking branches under <name>. |
Junio C Hamano | 39381a7 | 2007-02-02 07:35:15 | [diff] [blame] | 59 | These stale branches have already been removed from the remote repository |
Junio C Hamano | 0bbd467 | 2007-02-20 04:52:14 | [diff] [blame] | 60 | referenced by <name>, but are still locally available in |
| 61 | "remotes/<name>". |
Junio C Hamano | 401939f | 2007-07-01 06:34:30 | [diff] [blame] | 62 | + |
| 63 | With `-n` option, the remote heads are not confirmed first with `git |
| 64 | ls-remote <name>`; cached information is used instead. Use with |
| 65 | caution. |
Junio C Hamano | 0bbd467 | 2007-02-20 04:52:14 | [diff] [blame] | 66 | |
| 67 | 'update':: |
| 68 | |
Junio C Hamano | 118d277 | 2007-02-21 20:24:10 | [diff] [blame] | 69 | Fetch updates for a named set of remotes in the repository as defined by |
| 70 | remotes.<group>. If a named group is not specified on the command line, |
| 71 | the configuration parameter remotes.default will get used; if |
| 72 | remotes.default is not defined, all remotes which do not the |
| 73 | configuration parameter remote.<name>.skipDefaultUpdate set to true will |
| 74 | be updated. (See gitlink:git-config[1]). |
Junio C Hamano | 39381a7 | 2007-02-02 07:35:15 | [diff] [blame] | 75 | |
Junio C Hamano | ee1e428 | 2007-02-04 08:32:04 | [diff] [blame] | 76 | |
| 77 | DISCUSSION |
| 78 | ---------- |
| 79 | |
Junio C Hamano | 1d3a6c7 | 2007-01-09 11:13:47 | [diff] [blame] | 80 | The remote configuration is achieved using the `remote.origin.url` and |
| 81 | `remote.origin.fetch` configuration variables. (See |
Junio C Hamano | 7ad22dc | 2007-01-29 02:55:48 | [diff] [blame] | 82 | gitlink:git-config[1]). |
Junio C Hamano | 1d3a6c7 | 2007-01-09 11:13:47 | [diff] [blame] | 83 | |
| 84 | Examples |
| 85 | -------- |
| 86 | |
Junio C Hamano | 6ac2f14 | 2007-03-01 01:24:56 | [diff] [blame] | 87 | * Add a new remote, fetch, and check out a branch from it |
| 88 | + |
Junio C Hamano | 1d3a6c7 | 2007-01-09 11:13:47 | [diff] [blame] | 89 | ------------ |
| 90 | $ git remote |
| 91 | origin |
| 92 | $ git branch -r |
| 93 | origin/master |
| 94 | $ git remote add linux-nfs git://linux-nfs.org/pub/nfs-2.6.git |
| 95 | $ git remote |
| 96 | linux-nfs |
| 97 | origin |
| 98 | $ git fetch |
| 99 | * refs/remotes/linux-nfs/master: storing branch 'master' ... |
| 100 | commit: bf81b46 |
| 101 | $ git branch -r |
| 102 | origin/master |
| 103 | linux-nfs/master |
| 104 | $ git checkout -b nfs linux-nfs/master |
| 105 | ... |
| 106 | ------------ |
| 107 | |
Junio C Hamano | 6ac2f14 | 2007-03-01 01:24:56 | [diff] [blame] | 108 | * Imitate 'git clone' but track only selected branches |
| 109 | + |
| 110 | ------------ |
| 111 | $ mkdir project.git |
| 112 | $ cd project.git |
| 113 | $ git init |
| 114 | $ git remote add -f -t master -m master origin git://example.com/git.git/ |
| 115 | $ git merge origin |
| 116 | ------------ |
| 117 | |
| 118 | |
Junio C Hamano | 1d3a6c7 | 2007-01-09 11:13:47 | [diff] [blame] | 119 | See Also |
| 120 | -------- |
| 121 | gitlink:git-fetch[1] |
| 122 | gitlink:git-branch[1] |
Junio C Hamano | 7ad22dc | 2007-01-29 02:55:48 | [diff] [blame] | 123 | gitlink:git-config[1] |
Junio C Hamano | 1d3a6c7 | 2007-01-09 11:13:47 | [diff] [blame] | 124 | |
| 125 | Author |
| 126 | ------ |
| 127 | Written by Junio Hamano |
| 128 | |
| 129 | |
| 130 | Documentation |
| 131 | -------------- |
| 132 | Documentation by J. Bruce Fields and the git-list <git@vger.kernel.org>. |
| 133 | |
| 134 | |
| 135 | GIT |
| 136 | --- |
| 137 | Part of the gitlink:git[7] suite |