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