Update Git docs to 2.29.2
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-bundle.xml
blob927218aabb24f5dfefc49f2b75e8c479e51c6608
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE sect2 SYSTEM "../../../dtd/dblite.dtd">\r
3 \r
4 <sect2 lang="en" id="git-bundle(1)">\r
5     <title>git-bundle(1)</title>\r
6 <indexterm>\r
7 <primary>git-bundle(1)</primary>\r
8 </indexterm>\r
9 <simplesect id="git-bundle(1)__name">\r
10 <title>NAME</title>\r
11 <simpara>git-bundle - Move objects and refs by archive</simpara>\r
12 </simplesect>\r
13 <simplesect id="git-bundle(1)__synopsis">\r
14 <title>SYNOPSIS</title>\r
15 <blockquote>\r
16 <literallayout><emphasis>git bundle</emphasis> create [-q | --quiet | --progress | --all-progress] [--all-progress-implied] &lt;file&gt; &lt;git-rev-list-args&gt;\r
17 <emphasis>git bundle</emphasis> verify [-q | --quiet] &lt;file&gt;\r
18 <emphasis>git bundle</emphasis> list-heads &lt;file&gt; [&lt;refname&gt;&#8230;]\r
19 <emphasis>git bundle</emphasis> unbundle &lt;file&gt; [&lt;refname&gt;&#8230;]</literallayout>\r
20 </blockquote>\r
21 </simplesect>\r
22 <simplesect id="git-bundle(1)__description">\r
23 <title>DESCRIPTION</title>\r
24 <simpara>Some workflows require that one or more branches of development on one\r
25 machine be replicated on another machine, but the two machines cannot\r
26 be directly connected, and therefore the interactive Git protocols (git,\r
27 ssh, http) cannot be used.</simpara>\r
28 <simpara>The <emphasis>git bundle</emphasis> command packages objects and references in an archive\r
29 at the originating machine, which can then be imported into another\r
30 repository using <emphasis>git fetch</emphasis>, <emphasis>git pull</emphasis>, or <emphasis>git clone</emphasis>,\r
31 after moving the archive by some means (e.g., by sneakernet).</simpara>\r
32 <simpara>As no\r
33 direct connection between the repositories exists, the user must specify a\r
34 basis for the bundle that is held by the destination repository: the\r
35 bundle assumes that all objects in the basis are already in the\r
36 destination repository.</simpara>\r
37 </simplesect>\r
38 <simplesect id="git-bundle(1)__options">\r
39 <title>OPTIONS</title>\r
40 <variablelist>\r
41 <varlistentry>\r
42 <term>\r
43 create [options] &lt;file&gt; &lt;git-rev-list-args&gt;\r
44 </term>\r
45 <listitem>\r
46 <simpara>\r
47         Used to create a bundle named <emphasis>file</emphasis>.  This requires the\r
48         <emphasis>&lt;git-rev-list-args&gt;</emphasis> arguments to define the bundle contents.\r
49         <emphasis>options</emphasis> contains the options specific to the <emphasis>git bundle create</emphasis>\r
50         subcommand.\r
51 </simpara>\r
52 </listitem>\r
53 </varlistentry>\r
54 <varlistentry>\r
55 <term>\r
56 verify &lt;file&gt;\r
57 </term>\r
58 <listitem>\r
59 <simpara>\r
60         Used to check that a bundle file is valid and will apply\r
61         cleanly to the current repository.  This includes checks on the\r
62         bundle format itself as well as checking that the prerequisite\r
63         commits exist and are fully linked in the current repository.\r
64         <emphasis>git bundle</emphasis> prints a list of missing commits, if any, and exits\r
65         with a non-zero status.\r
66 </simpara>\r
67 </listitem>\r
68 </varlistentry>\r
69 <varlistentry>\r
70 <term>\r
71 list-heads &lt;file&gt;\r
72 </term>\r
73 <listitem>\r
74 <simpara>\r
75         Lists the references defined in the bundle.  If followed by a\r
76         list of references, only references matching those given are\r
77         printed out.\r
78 </simpara>\r
79 </listitem>\r
80 </varlistentry>\r
81 <varlistentry>\r
82 <term>\r
83 unbundle &lt;file&gt;\r
84 </term>\r
85 <listitem>\r
86 <simpara>\r
87         Passes the objects in the bundle to <emphasis>git index-pack</emphasis>\r
88         for storage in the repository, then prints the names of all\r
89         defined references. If a list of references is given, only\r
90         references matching those in the list are printed. This command is\r
91         really plumbing, intended to be called only by <emphasis>git fetch</emphasis>.\r
92 </simpara>\r
93 </listitem>\r
94 </varlistentry>\r
95 <varlistentry>\r
96 <term>\r
97 &lt;git-rev-list-args&gt;\r
98 </term>\r
99 <listitem>\r
100 <simpara>\r
101         A list of arguments, acceptable to <emphasis>git rev-parse</emphasis> and\r
102         <emphasis>git rev-list</emphasis> (and containing a named ref, see SPECIFYING REFERENCES\r
103         below), that specifies the specific objects and references\r
104         to transport.  For example, <emphasis>master~10..master</emphasis> causes the\r
105         current master reference to be packaged along with all objects\r
106         added since its 10th ancestor commit.  There is no explicit\r
107         limit to the number of references and objects that may be\r
108         packaged.\r
109 </simpara>\r
110 </listitem>\r
111 </varlistentry>\r
112 <varlistentry>\r
113 <term>\r
114 [&lt;refname&gt;&#8230;]\r
115 </term>\r
116 <listitem>\r
117 <simpara>\r
118         A list of references used to limit the references reported as\r
119         available. This is principally of use to <emphasis>git fetch</emphasis>, which\r
120         expects to receive only those references asked for and not\r
121         necessarily everything in the pack (in this case, <emphasis>git bundle</emphasis> acts\r
122         like <emphasis>git fetch-pack</emphasis>).\r
123 </simpara>\r
124 </listitem>\r
125 </varlistentry>\r
126 <varlistentry>\r
127 <term>\r
128 --progress\r
129 </term>\r
130 <listitem>\r
131 <simpara>\r
132         Progress status is reported on the standard error stream\r
133         by default when it is attached to a terminal, unless -q\r
134         is specified. This flag forces progress status even if\r
135         the standard error stream is not directed to a terminal.\r
136 </simpara>\r
137 </listitem>\r
138 </varlistentry>\r
139 <varlistentry>\r
140 <term>\r
141 --all-progress\r
142 </term>\r
143 <listitem>\r
144 <simpara>\r
145         When --stdout is specified then progress report is\r
146         displayed during the object count and compression phases\r
147         but inhibited during the write-out phase. The reason is\r
148         that in some cases the output stream is directly linked\r
149         to another command which may wish to display progress\r
150         status of its own as it processes incoming pack data.\r
151         This flag is like --progress except that it forces progress\r
152         report for the write-out phase as well even if --stdout is\r
153         used.\r
154 </simpara>\r
155 </listitem>\r
156 </varlistentry>\r
157 <varlistentry>\r
158 <term>\r
159 --all-progress-implied\r
160 </term>\r
161 <listitem>\r
162 <simpara>\r
163         This is used to imply --all-progress whenever progress display\r
164         is activated.  Unlike --all-progress this flag doesn't actually\r
165         force any progress display by itself.\r
166 </simpara>\r
167 </listitem>\r
168 </varlistentry>\r
169 <varlistentry>\r
170 <term>\r
171 -q\r
172 </term>\r
173 <term>\r
174 --quiet\r
175 </term>\r
176 <listitem>\r
177 <simpara>\r
178         This flag makes the command not to report its progress\r
179         on the standard error stream.\r
180 </simpara>\r
181 </listitem>\r
182 </varlistentry>\r
183 </variablelist>\r
184 </simplesect>\r
185 <simplesect id="git-bundle(1)__specifying_references">\r
186 <title>SPECIFYING REFERENCES</title>\r
187 <simpara><emphasis>git bundle</emphasis> will only package references that are shown by\r
188 <emphasis>git show-ref</emphasis>: this includes heads, tags, and remote heads.  References\r
189 such as <emphasis>master~1</emphasis> cannot be packaged, but are perfectly suitable for\r
190 defining the basis.  More than one reference may be packaged, and more\r
191 than one basis can be specified.  The objects packaged are those not\r
192 contained in the union of the given bases.  Each basis can be\r
193 specified explicitly (e.g. <emphasis>^master~10</emphasis>), or implicitly (e.g.\r
194 <emphasis>master~10..master</emphasis>, <emphasis>--since=10.days.ago master</emphasis>).</simpara>\r
195 <simpara>It is very important that the basis used be held by the destination.\r
196 It is okay to err on the side of caution, causing the bundle file\r
197 to contain objects already in the destination, as these are ignored\r
198 when unpacking at the destination.</simpara>\r
199 <simpara><emphasis>git clone</emphasis> can use any bundle created without negative refspecs\r
200 (e.g., <emphasis>new</emphasis>, but not <emphasis>old..new</emphasis>).\r
201 If you want to match <emphasis>git clone --mirror</emphasis>, which would include your\r
202 refs such as <emphasis>refs/remotes/*</emphasis>, use <emphasis>--all</emphasis>.\r
203 If you want to provide the same set of refs that a clone directly\r
204 from the source repository would get, use <emphasis>--branches --tags</emphasis> for\r
205 the <emphasis>&lt;git-rev-list-args&gt;</emphasis>.</simpara>\r
206 </simplesect>\r
207 <simplesect id="git-bundle(1)__examples">\r
208 <title>EXAMPLES</title>\r
209 <simpara>Assume you want to transfer the history from a repository R1 on machine A\r
210 to another repository R2 on machine B.\r
211 For whatever reason, direct connection between A and B is not allowed,\r
212 but we can move data from A to B via some mechanism (CD, email, etc.).\r
213 We want to update R2 with development made on the branch master in R1.</simpara>\r
214 <simpara>To bootstrap the process, you can first create a bundle that does not have\r
215 any basis. You can use a tag to remember up to what commit you last\r
216 processed, in order to make it easy to later update the other repository\r
217 with an incremental bundle:</simpara>\r
218 <screen>machineA$ cd R1\r
219 machineA$ git bundle create file.bundle master\r
220 machineA$ git tag -f lastR2bundle master</screen>\r
221 <simpara>Then you transfer file.bundle to the target machine B. Because this\r
222 bundle does not require any existing object to be extracted, you can\r
223 create a new repository on machine B by cloning from it:</simpara>\r
224 <screen>machineB$ git clone -b master /home/me/tmp/file.bundle R2</screen>\r
225 <simpara>This will define a remote called "origin" in the resulting repository that\r
226 lets you fetch and pull from the bundle. The $GIT_DIR/config file in R2 will\r
227 have an entry like this:</simpara>\r
228 <screen>[remote "origin"]\r
229     url = /home/me/tmp/file.bundle\r
230     fetch = refs/heads/*:refs/remotes/origin/*</screen>\r
231 <simpara>To update the resulting mine.git repository, you can fetch or pull after\r
232 replacing the bundle stored at /home/me/tmp/file.bundle with incremental\r
233 updates.</simpara>\r
234 <simpara>After working some more in the original repository, you can create an\r
235 incremental bundle to update the other repository:</simpara>\r
236 <screen>machineA$ cd R1\r
237 machineA$ git bundle create file.bundle lastR2bundle..master\r
238 machineA$ git tag -f lastR2bundle master</screen>\r
239 <simpara>You then transfer the bundle to the other machine to replace\r
240 /home/me/tmp/file.bundle, and pull from it.</simpara>\r
241 <screen>machineB$ cd R2\r
242 machineB$ git pull</screen>\r
243 <simpara>If you know up to what commit the intended recipient repository should\r
244 have the necessary objects, you can use that knowledge to specify the\r
245 basis, giving a cut-off point to limit the revisions and objects that go\r
246 in the resulting bundle. The previous example used the lastR2bundle tag\r
247 for this purpose, but you can use any other options that you would give to\r
248 the <xref linkend="git-log(1)" /> command. Here are more examples:</simpara>\r
249 <simpara>You can use a tag that is present in both:</simpara>\r
250 <screen>$ git bundle create mybundle v1.0.0..master</screen>\r
251 <simpara>You can use a basis based on time:</simpara>\r
252 <screen>$ git bundle create mybundle --since=10.days master</screen>\r
253 <simpara>You can use the number of commits:</simpara>\r
254 <screen>$ git bundle create mybundle -10 master</screen>\r
255 <simpara>You can run <emphasis>git-bundle verify</emphasis> to see if you can extract from a bundle\r
256 that was created with a basis:</simpara>\r
257 <screen>$ git bundle verify mybundle</screen>\r
258 <simpara>This will list what commits you must have in order to extract from the\r
259 bundle and will error out if you do not have them.</simpara>\r
260 <simpara>A bundle from a recipient repository's point of view is just like a\r
261 regular repository which it fetches or pulls from. You can, for example, map\r
262 references when fetching:</simpara>\r
263 <screen>$ git fetch mybundle master:localRef</screen>\r
264 <simpara>You can also see what references it offers:</simpara>\r
265 <screen>$ git ls-remote mybundle</screen>\r
266 </simplesect>\r
267 <simplesect id="git-bundle(1)__git">\r
268 <title>GIT</title>\r
269 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>\r
270 </simplesect>\r
271 </sect2>\r