Autogenerated man pages for v1.4.0-rc2-g5e3a6
[git.git] / man1 / git-clone.1
1 .\"Generated by db2man.xsl. Don't modify this, modify the source.
2 .de Sh \" Subsection
3 .br
4 .if t .Sp
5 .ne 5
6 .PP
7 \fB\\$1\fR
8 .PP
9 ..
10 .de Sp \" Vertical space (when we can't use .PP)
11 .if t .sp .5v
12 .if n .sp
13 ..
14 .de Ip \" List item
15 .br
16 .ie \\n(.$>=3 .ne \\$3
17 .el .ne 3
18 .IP "\\$1" \\$2
19 ..
20 .TH "GIT-CLONE" 1 "" "" ""
21 .SH NAME
22 git-clone \- Clones a repository
23 .SH "SYNOPSIS"
24
25 .nf
26 \fIgit\-clone\fR [\-\-template=<template_directory>] [\-l [\-s]] [\-q] [\-n] [\-\-bare]
27           [\-o <name>] [\-u <upload\-pack>] [\-\-reference <repository>]
28           [\-\-use\-separate\-remote] <repository> [<directory>]
29 .fi
30
31 .SH "DESCRIPTION"
32
33
34 Clones a repository into a newly created directory\&. All remote branch heads are copied under $GIT_DIR/refs/heads/, except that the remote master is also copied to origin branch\&.
35
36
37 In addition, $GIT_DIR/remotes/origin file is set up to have this line:
38
39 .nf
40 Pull: master:origin
41 .fi
42
43
44 This is to help the typical workflow of working off of the remote master branch\&. Every time git pull without argument is run, the progress on the remote master branch is tracked by copying it into the local origin branch, and merged into the branch you are currently working on\&. Remote branches other than master are also added there to be tracked\&.
45
46 .SH "OPTIONS"
47
48 .TP
49 \-\-local, \-l
50 When the repository to clone from is on a local machine, this flag bypasses normal "git aware" transport mechanism and clones the repository by making a copy of HEAD and everything under objects and refs directories\&. The files under \&.git/objects/ directory are hardlinked to save space when possible\&.
51
52 .TP
53 \-\-shared, \-s
54 When the repository to clone is on the local machine, instead of using hard links, automatically setup \&.git/objects/info/alternates to share the objects with the source repository\&. The resulting repository starts out without any object of its own\&.
55
56 .TP
57 \-\-reference <repository>
58 If the reference repository is on the local machine automatically setup \&.git/objects/info/alternates to obtain objects from the reference repository\&. Using an already existing repository as an alternate will require less objects to be copied from the repository being cloned, reducing network and local storage costs\&.
59
60 .TP
61 \-\-quiet, \-q
62 Operate quietly\&. This flag is passed to "rsync" and "git\-clone\-pack" commands when given\&.
63
64 .TP
65 \-n
66 No checkout of HEAD is performed after the clone is complete\&.
67
68 .TP
69 \-\-bare
70 Make a \fIbare\fR GIT repository\&. That is, instead of creating <directory> and placing the administrative files in <directory>/\&.git, make the <directory> itself the $GIT_DIR\&. This implies \-n option\&. When this option is used, neither the origin branch nor the default remotes/origin file is created\&.
71
72 .TP
73 \-o <name>
74 Instead of using the branch name \fIorigin\fR to keep track of the upstream repository, use <name> instead\&. Note that the shorthand name stored in remotes/origin is not affected, but the local branch name to pull the remote master branch into is\&.
75
76 .TP
77 \-\-upload\-pack <upload\-pack>, \-u <upload\-pack>
78 When given, and the repository to clone from is handled by \fIgit\-clone\-pack\fR, \fI\-\-exec=<upload\-pack>\fR is passed to the command to specify non\-default path for the command run on the other end\&.
79
80 .TP
81 \-\-template=<template_directory>
82 Specify the directory from which templates will be used; if unset the templates are taken from the installation defined default, typically /usr/share/git\-core/templates\&.
83
84 .TP
85 \-\-use\-separate\-remote
86 Save remotes heads under $GIT_DIR/remotes/origin/ instead of $GIT_DIR/refs/heads/\&. Only the master branch is saved in the latter\&.
87
88 .TP
89 <repository>
90 The (possibly remote) repository to clone from\&. It can be any URL git\-fetch supports\&.
91
92 .TP
93 <directory>
94 The name of a new directory to clone into\&. The "humanish" part of the source repository is used if no directory is explicitly given ("repo" for "/path/to/repo\&.git" and "foo" for "host\&.xz:foo/\&.git")\&. Cloning into an existing directory is not allowed\&.
95
96 .SH "EXAMPLES"
97
98 .TP
99 Clone from upstream
100
101 .nf
102 $ git clone git://git\&.kernel\&.org/pub/scm/\&.\&.\&./linux\-2\&.6 my2\&.6
103 $ cd my2\&.6
104 $ make
105 .fi
106
107 .TP
108 Make a local clone that borrows from the current directory, without checking things out
109
110 .nf
111 $ git clone \-l \-s \-n \&. \&.\&./copy
112 $ cd copy
113 $ git show\-branch
114 .fi
115
116 .TP
117 Clone from upstream while borrowing from an existing local directory
118
119 .nf
120 $ git clone \-\-reference my2\&.6 \\
121         git://git\&.kernel\&.org/pub/scm/\&.\&.\&./linux\-2\&.7 \\
122         my2\&.7
123 $ cd my2\&.7
124 .fi
125
126 .TP
127 Create a bare repository to publish your changes to the public
128
129 .nf
130 $ git clone \-\-bare \-l /home/proj/\&.git /pub/scm/proj\&.git
131 .fi
132
133 .TP
134 Create a repository on the kernel\&.org machine that borrows from Linus
135
136 .nf
137 $ git clone \-\-bare \-l \-s /pub/scm/\&.\&.\&./torvalds/linux\-2\&.6\&.git \\
138     /pub/scm/\&.\&.\&./me/subsys\-2\&.6\&.git
139 .fi
140
141 .SH "AUTHOR"
142
143
144 Written by Linus Torvalds <torvalds@osdl\&.org>
145
146 .SH "DOCUMENTATION"
147
148
149 Documentation by Junio C Hamano and the git\-list <git@vger\&.kernel\&.org>\&.
150
151 .SH "GIT"
152
153
154 Part of the \fBgit\fR(7) suite
155