bd5dee9ea708993d6fb8ad1e785702ae60e942c0
[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 git\-clone [\-l [\-s]] [\-q] [\-n] [\-\-naked] [\-o <name>] [\-u <upload\-pack>]
27           <repository> [<directory>]
28 .fi
29
30 .SH "DESCRIPTION"
31
32
33 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\&.
34
35
36 In addition, $GIT_DIR/remotes/origin file is set up to have this line:
37
38 .nf
39 Pull: master:origin
40 .fi
41
42
43 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\&.
44
45 .SH "OPTIONS"
46
47 .TP
48 \-\-local, \-l, 
49 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\&.
50
51 .TP
52 \-\-shared, \-s, 
53 When the repository to clone is on the local machine, instead of using hard links, automatically setup \&.git/objects/info/alternatives to share the objects with the source repository\&. The resulting repository starts out without any object of its own\&.
54
55 .TP
56 \-\-quiet, \-q, 
57 Operate quietly\&. This flag is passed to "rsync" and "git\-clone\-pack" commands when given\&.
58
59 .TP
60 \-n
61 No checkout of HEAD is performed after the clone is complete\&.
62
63 .TP
64 \-\-naked
65 Make a naked 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\&.
66
67 .TP
68 \-o <name>
69 Instead of using the branch name origin 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\&.
70
71 .TP
72 \-\-upload\-pack <upload\-pack>, \-u <upload\-pack>, 
73 When given, and the repository to clone from is handled by git\-clone\-pack, \-\-exec=<upload\-pack> is passed to the command to specify non\-default path for the command run on the other end\&.
74
75 .TP
76 <repository>
77 The (possibly remote) repository to clone from\&. It can be any URL git\-fetch supports\&.
78
79 .TP
80 <directory>
81 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\&.
82
83 .SS "Examples"
84
85 .TP
86 Clone from upstream
87
88 .IP
89 $ git clone git://git\&.kernel\&.org/pub/scm/\&.\&.\&./linux\-2\&.6 my2\&.6
90 $ cd my2\&.6
91 $ make
92 .TP
93 Make a local clone that borrows from the current directory, without checking things out
94
95 .IP
96 $ git clone \-l \-s \-n \&. \&.\&./copy
97 $ cd copy
98 $ git show\-branch
99 .TP
100 Create a naked repository to publish your changes to the public
101
102 .IP
103 $ git clone \-\-naked \-l /home/proj/\&.git /pub/scm/proj\&.git
104 .TP
105 Create a repository on the kernel\&.org machine that borrows from Linus
106
107 .IP
108 $ git clone \-\-naked \-l \-s /pub/scm/\&.\&.\&./torvalds/linux\-2\&.6\&.git \\
109     /pub/scm/\&.\&.\&./me/subsys\-2\&.6\&.git
110 .SH "AUTHOR"
111
112
113 Written by Linus Torvalds <torvalds@osdl\&.org>
114
115 .SH "DOCUMENTATION"
116
117
118 Documentation by Junio C Hamano and the git\-list <git@vger\&.kernel\&.org>\&.
119
120 .SH "GIT"
121
122
123 Part of the \fBgit\fR(7) suite
124