]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-clone.txt
Wrap synopsis lines and use [verse] to keep formatting
[thirdparty/git.git] / Documentation / git-clone.txt
CommitLineData
215a7ad1
JH
1git-clone(1)
2============
6ec311da
JH
3
4NAME
5----
215a7ad1 6git-clone - Clones a repository.
6ec311da
JH
7
8
9SYNOPSIS
10--------
353ce815
JF
11[verse]
12'git-clone' [-l [-s]] [-q] [-n] [-u <upload-pack>]
13 <repository> [<directory>]
6ec311da
JH
14
15DESCRIPTION
16-----------
4607166d
JH
17Clones a repository into a newly created directory. All remote
18branch heads are copied under `$GIT_DIR/refs/heads/`, except
19that the remote `master` is also copied to `origin` branch.
20
21In addition, `$GIT_DIR/remotes/origin` file is set up to have
22this line:
23
24 Pull: master:origin
25
26This is to help the typical workflow of working off of the
27remote `master` branch. Every time `git pull` without argument
28is run, the progress on the remote `master` branch is tracked by
29copying it into the local `origin` branch, and merged into the
95d117b6
JH
30branch you are currently working on. Remote branches other than
31`master` are also added there to be tracked.
4607166d 32
6ec311da
JH
33
34OPTIONS
35-------
a2775c2a 36--local::
6ec311da
JH
37-l::
38 When the repository to clone from is on a local machine,
39 this flag bypasses normal "git aware" transport
40 mechanism and clones the repository by making a copy of
41 HEAD and everything under objects and refs directories.
42 The files under .git/objects/ directory are hardlinked
43 to save space when possible.
44
a2775c2a
EB
45--shared::
46-s::
47 When the repository to clone is on the local machine,
4607166d 48 instead of using hard links, automatically setup
a2775c2a 49 .git/objects/info/alternatives to share the objects
4607166d
JH
50 with the source repository. The resulting repository
51 starts out without any object of its own.
a2775c2a
EB
52
53--quiet::
6ec311da
JH
54-q::
55 Operate quietly. This flag is passed to "rsync" and
56 "git-clone-pack" commands when given.
57
a2775c2a
EB
58-n::
59 No checkout of HEAD is performed after the clone is complete.
60
61--upload-pack <upload-pack>::
6ec311da
JH
62-u <upload-pack>::
63 When given, and the repository to clone from is handled
64 by 'git-clone-pack', '--exec=<upload-pack>' is passed to
65 the command to specify non-default path for the command
66 run on the other end.
67
68<repository>::
69 The (possibly remote) repository to clone from. It can
4607166d 70 be any URL git-fetch supports.
6ec311da
JH
71
72<directory>::
0879aa28
AE
73 The name of a new directory to clone into. The "humanish"
74 part of the source repository is used if no directory is
75 explicitly given ("repo" for "/path/to/repo.git" and "foo"
76 for "host.xz:foo/.git"). Cloning into an existing directory
77 is not allowed.
4607166d 78
1e2ccd3a
JH
79Examples
80~~~~~~~~
81
82Clone from upstream::
83+
84------------
85$ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6
86$ cd my2.6
87$ make
88------------
89
90
91Make a local clone that borrows from the current directory, without checking things out::
92+
93------------
94$ git clone -l -s -n . ../copy
95$ cd copy
96$ git show-branch
97------------
98
6ec311da
JH
99Author
100------
101Written by Linus Torvalds <torvalds@osdl.org>
102
1e2ccd3a 103
6ec311da
JH
104Documentation
105--------------
0879aa28 106Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
6ec311da
JH
107
108
109GIT
110---
a7154e91 111Part of the gitlink:git[7] suite
6ec311da 112