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