merge-recursive implicitely depends on trust_executable_bit
[git/fastimport.git] / Documentation / git-clone.txt
blob86060472ad88088bcb59df5eb9acce097f68cb83
1 git-clone(1)
2 ============
4 NAME
5 ----
6 git-clone - Clones a repository
9 SYNOPSIS
10 --------
11 [verse]
12 'git-clone' [--template=<template_directory>] [-l [-s]] [-q] [-n] [--bare]
13           [-o <name>] [-u <upload-pack>] [--reference <repository>]
14           [--use-separate-remote] <repository> [<directory>]
16 DESCRIPTION
17 -----------
18 Clones a repository into a newly created directory.  All remote
19 branch heads are copied under `$GIT_DIR/refs/heads/`, except
20 that the remote `master` is also copied to `origin` branch.
22 In addition, `$GIT_DIR/remotes/origin` file is set up to have
23 this line:
25         Pull: master:origin
27 This is to help the typical workflow of working off of the
28 remote `master` branch.  Every time `git pull` without argument
29 is run, the progress on the remote `master` branch is tracked by
30 copying it into the local `origin` branch, and merged into the
31 branch you are currently working on.  Remote branches other than
32 `master` are also added there to be tracked.
35 OPTIONS
36 -------
37 --local::
38 -l::
39         When the repository to clone from is on a local machine,
40         this flag bypasses normal "git aware" transport
41         mechanism and clones the repository by making a copy of
42         HEAD and everything under objects and refs directories.
43         The files under .git/objects/ directory are hardlinked
44         to save space when possible.
46 --shared::
47 -s::
48         When the repository to clone is on the local machine,
49         instead of using hard links, automatically setup
50         .git/objects/info/alternates to share the objects
51         with the source repository.  The resulting repository
52         starts out without any object of its own.
54 --reference <repository>::
55         If the reference repository is on the local machine
56         automatically setup .git/objects/info/alternates to
57         obtain objects from the reference repository.  Using
58         an already existing repository as an alternate will
59         require less objects to be copied from the repository
60         being cloned, reducing network and local storage costs.
62 --quiet::
63 -q::
64         Operate quietly.  This flag is passed to "rsync" and
65         "git-fetch-pack" commands when given.
67 -n::
68         No checkout of HEAD is performed after the clone is complete.
70 --bare::
71         Make a 'bare' GIT repository.  That is, instead of
72         creating `<directory>` and placing the administrative
73         files in `<directory>/.git`, make the `<directory>`
74         itself the `$GIT_DIR`. This implies `-n` option.  When
75         this option is used, neither the `origin` branch nor the
76         default `remotes/origin` file is created.
78 --origin <name>::
79 -o <name>::
80         Instead of using the branch name 'origin' to keep track
81         of the upstream repository, use <name> instead.  Note
82         that the shorthand name stored in `remotes/origin` is
83         not affected, but the local branch name to pull the
84         remote `master` branch into is.
86 --upload-pack <upload-pack>::
87 -u <upload-pack>::
88         When given, and the repository to clone from is handled
89         by 'git-fetch-pack', '--exec=<upload-pack>' is passed to
90         the command to specify non-default path for the command
91         run on the other end.
93 --template=<template_directory>::
94         Specify the directory from which templates will be used;
95         if unset the templates are taken from the installation
96         defined default, typically `/usr/share/git-core/templates`.
98 --use-separate-remote::
99         Save remotes heads under `$GIT_DIR/remotes/origin/` instead
100         of `$GIT_DIR/refs/heads/`.  Only the master branch is saved
101         in the latter.
103 <repository>::
104         The (possibly remote) repository to clone from.  It can
105         be any URL git-fetch supports.
107 <directory>::
108         The name of a new directory to clone into.  The "humanish"
109         part of the source repository is used if no directory is
110         explicitly given ("repo" for "/path/to/repo.git" and "foo"
111         for "host.xz:foo/.git").  Cloning into an existing directory
112         is not allowed.
114 Examples
115 --------
117 Clone from upstream::
119 ------------
120 $ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6
121 $ cd my2.6
122 $ make
123 ------------
126 Make a local clone that borrows from the current directory, without checking things out::
128 ------------
129 $ git clone -l -s -n . ../copy
130 $ cd copy
131 $ git show-branch
132 ------------
135 Clone from upstream while borrowing from an existing local directory::
137 ------------
138 $ git clone --reference my2.6 \
139         git://git.kernel.org/pub/scm/.../linux-2.7 \
140         my2.7
141 $ cd my2.7
142 ------------
145 Create a bare repository to publish your changes to the public::
147 ------------
148 $ git clone --bare -l /home/proj/.git /pub/scm/proj.git
149 ------------
152 Create a repository on the kernel.org machine that borrows from Linus::
154 ------------
155 $ git clone --bare -l -s /pub/scm/.../torvalds/linux-2.6.git \
156     /pub/scm/.../me/subsys-2.6.git
157 ------------
160 Author
161 ------
162 Written by Linus Torvalds <torvalds@osdl.org>
165 Documentation
166 --------------
167 Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
172 Part of the gitlink:git[7] suite