Start preparing Release Notes for 1.5.0.3
[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
17 DESCRIPTION
18 -----------
19
20 Manage the set of repositories ("remotes") whose branches you track.
21
22
23 COMMANDS
24 --------
25
26 With no arguments, shows a list of existing remotes. Several
27 subcommands are available to perform operations on the remotes.
28
29 'add'::
30
31 Adds a remote named <name> for the repository at
32 <url>. The command `git fetch <name>` can then be used to create and
33 update remote-tracking branches <name>/<branch>.
34 +
35 With `-f` option, `git fetch <name>` is run immediately after
36 the remote information is set up.
37 +
38 With `-t <branch>` option, instead of the default glob
39 refspec for the remote to track all branches under
40 `$GIT_DIR/remotes/<name>/`, a refspec to track only `<branch>`
41 is created. You can give more than one `-t <branch>` to track
42 multiple branche without grabbing all branches.
43 +
44 With `-m <master>` option, `$GIT_DIR/remotes/<name>/HEAD` is set
45 up to point at remote's `<master>` branch instead of whatever
46 branch the `HEAD` at the remote repository actually points at.
47
48 'show'::
49
50 Gives some information about the remote <name>.
51
52 'prune'::
53
54 Deletes all stale tracking branches under <name>.
55 These stale branches have already been removed from the remote repository
56 referenced by <name>, but are still locally available in "remotes/<name>".
57
58
59 DISCUSSION
60 ----------
61
62 The remote configuration is achieved using the `remote.origin.url` and
63 `remote.origin.fetch` configuration variables. (See
64 gitlink:git-config[1]).
65
66 Examples
67 --------
68
69 * Add a new remote, fetch, and check out a branch from it
70 +
71 ------------
72 $ git remote
73 origin
74 $ git branch -r
75 origin/master
76 $ git remote add linux-nfs git://linux-nfs.org/pub/nfs-2.6.git
77 $ git remote
78 linux-nfs
79 origin
80 $ git fetch
81 * refs/remotes/linux-nfs/master: storing branch 'master' ...
82 commit: bf81b46
83 $ git branch -r
84 origin/master
85 linux-nfs/master
86 $ git checkout -b nfs linux-nfs/master
87 ...
88 ------------
89
90 * Imitate 'git clone' but track only selected branches
91 +
92 ------------
93 $ mkdir project.git
94 $ cd project.git
95 $ git init
96 $ git remote add -f -t master -m master origin git://example.com/git.git/
97 $ git merge origin
98 ------------
99
100
101 See Also
102 --------
103 gitlink:git-fetch[1]
104 gitlink:git-branch[1]
105 gitlink:git-config[1]
106
107 Author
108 ------
109 Written by Junio Hamano
110
111
112 Documentation
113 --------------
114 Documentation by J. Bruce Fields and the git-list <git@vger.kernel.org>.
115
116
117 GIT
118 ---
119 Part of the gitlink:git[7] suite
120