Merge branch 'maint'
[git/git.git] / Documentation / git-remote.txt
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'
13 'git-remote' add [-t <branch>] [-m <branch>] [-f] <name> <url>
14 'git-remote' show <name>
15 'git-remote' prune <name>
16 'git-remote' update [group]
17
18 DESCRIPTION
19 -----------
20
21 Manage the set of repositories ("remotes") whose branches you track.
22
23
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
33 <url>. The command `git fetch <name>` can then be used to create and
34 update remote-tracking branches <name>/<branch>.
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
43 multiple branche without grabbing all branches.
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.
48
49 'show'::
50
51 Gives some information about the remote <name>.
52
53 'prune'::
54
55 Deletes all stale tracking branches under <name>.
56 These stale branches have already been removed from the remote repository
57 referenced by <name>, but are still locally available in
58 "remotes/<name>".
59
60 'update'::
61
62 Fetch updates for a named set of remotes in the repository as defined by
63 remotes.<group>. If a named group is not specified on the command line,
64 the configuration parameter remotes.default will get used; if
65 remotes.default is not defined, all remotes which do not the
66 configuration parameter remote.<name>.skipDefaultUpdate set to true will
67 be updated. (See gitlink:git-config[1]).
68
69
70 DISCUSSION
71 ----------
72
73 The remote configuration is achieved using the `remote.origin.url` and
74 `remote.origin.fetch` configuration variables. (See
75 gitlink:git-config[1]).
76
77 Examples
78 --------
79
80 * Add a new remote, fetch, and check out a branch from it
81 +
82 ------------
83 $ git remote
84 origin
85 $ git branch -r
86 origin/master
87 $ git remote add linux-nfs git://linux-nfs.org/pub/nfs-2.6.git
88 $ git remote
89 linux-nfs
90 origin
91 $ git fetch
92 * refs/remotes/linux-nfs/master: storing branch 'master' ...
93 commit: bf81b46
94 $ git branch -r
95 origin/master
96 linux-nfs/master
97 $ git checkout -b nfs linux-nfs/master
98 ...
99 ------------
100
101 * Imitate 'git clone' but track only selected branches
102 +
103 ------------
104 $ mkdir project.git
105 $ cd project.git
106 $ git init
107 $ git remote add -f -t master -m master origin git://example.com/git.git/
108 $ git merge origin
109 ------------
110
111
112 See Also
113 --------
114 gitlink:git-fetch[1]
115 gitlink:git-branch[1]
116 gitlink:git-config[1]
117
118 Author
119 ------
120 Written by Junio Hamano
121
122
123 Documentation
124 --------------
125 Documentation by J. Bruce Fields and the git-list <git@vger.kernel.org>.
126
127
128 GIT
129 ---
130 Part of the gitlink:git[7] suite
131