Updated git_doc to git 1.8
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-bundle.xml
blob1944f50c07ebf7ed25bd5fd4eb5dae7e81872ea5
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE sect2 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.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 &lt;file&gt; &lt;git-rev-list-args&gt;\r
17 <emphasis>git bundle</emphasis> verify &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, rsync, http) cannot be used.  This command provides support for\r
28 <emphasis>git fetch</emphasis> and <emphasis>git pull</emphasis> to operate by packaging objects and references\r
29 in an archive at the originating machine, then importing those into\r
30 another repository using <emphasis>git fetch</emphasis> and <emphasis>git pull</emphasis>\r
31 after moving the archive by some means (e.g., by sneakernet).  As no\r
32 direct connection between the repositories exists, the user must specify a\r
33 basis for the bundle that is held by the destination repository: the\r
34 bundle assumes that all objects in the basis are already in the\r
35 destination repository.</simpara>\r
36 </simplesect>\r
37 <simplesect id="git-bundle(1)__options">\r
38 <title>OPTIONS</title>\r
39 <variablelist>\r
40 <varlistentry>\r
41 <term>\r
42 create &lt;file&gt;\r
43 </term>\r
44 <listitem>\r
45 <simpara>\r
46         Used to create a bundle named <emphasis>file</emphasis>.  This requires the\r
47         <emphasis>git-rev-list-args</emphasis> arguments to define the bundle contents.\r
48 </simpara>\r
49 </listitem>\r
50 </varlistentry>\r
51 <varlistentry>\r
52 <term>\r
53 verify &lt;file&gt;\r
54 </term>\r
55 <listitem>\r
56 <simpara>\r
57         Used to check that a bundle file is valid and will apply\r
58         cleanly to the current repository.  This includes checks on the\r
59         bundle format itself as well as checking that the prerequisite\r
60         commits exist and are fully linked in the current repository.\r
61         <emphasis>git bundle</emphasis> prints a list of missing commits, if any, and exits\r
62         with a non-zero status.\r
63 </simpara>\r
64 </listitem>\r
65 </varlistentry>\r
66 <varlistentry>\r
67 <term>\r
68 list-heads &lt;file&gt;\r
69 </term>\r
70 <listitem>\r
71 <simpara>\r
72         Lists the references defined in the bundle.  If followed by a\r
73         list of references, only references matching those given are\r
74         printed out.\r
75 </simpara>\r
76 </listitem>\r
77 </varlistentry>\r
78 <varlistentry>\r
79 <term>\r
80 unbundle &lt;file&gt;\r
81 </term>\r
82 <listitem>\r
83 <simpara>\r
84         Passes the objects in the bundle to <emphasis>git index-pack</emphasis>\r
85         for storage in the repository, then prints the names of all\r
86         defined references. If a list of references is given, only\r
87         references matching those in the list are printed. This command is\r
88         really plumbing, intended to be called only by <emphasis>git fetch</emphasis>.\r
89 </simpara>\r
90 </listitem>\r
91 </varlistentry>\r
92 <varlistentry>\r
93 <term>\r
94 &lt;git-rev-list-args&gt;\r
95 </term>\r
96 <listitem>\r
97 <simpara>\r
98         A list of arguments, acceptable to <emphasis>git rev-parse</emphasis> and\r
99         <emphasis>git rev-list</emphasis> (and containing a named ref, see SPECIFYING REFERENCES\r
100         below), that specifies the specific objects and references\r
101         to transport.  For example, <emphasis>master~10..master</emphasis> causes the\r
102         current master reference to be packaged along with all objects\r
103         added since its 10th ancestor commit.  There is no explicit\r
104         limit to the number of references and objects that may be\r
105         packaged.\r
106 </simpara>\r
107 </listitem>\r
108 </varlistentry>\r
109 <varlistentry>\r
110 <term>\r
111 [&lt;refname&gt;&#8230;]\r
112 </term>\r
113 <listitem>\r
114 <simpara>\r
115         A list of references used to limit the references reported as\r
116         available. This is principally of use to <emphasis>git fetch</emphasis>, which\r
117         expects to receive only those references asked for and not\r
118         necessarily everything in the pack (in this case, <emphasis>git bundle</emphasis> acts\r
119         like <emphasis>git fetch-pack</emphasis>).\r
120 </simpara>\r
121 </listitem>\r
122 </varlistentry>\r
123 </variablelist>\r
124 </simplesect>\r
125 <simplesect id="git-bundle(1)__specifying_references">\r
126 <title>SPECIFYING REFERENCES</title>\r
127 <simpara><emphasis>git bundle</emphasis> will only package references that are shown by\r
128 <emphasis>git show-ref</emphasis>: this includes heads, tags, and remote heads.  References\r
129 such as <emphasis>master~1</emphasis> cannot be packaged, but are perfectly suitable for\r
130 defining the basis.  More than one reference may be packaged, and more\r
131 than one basis can be specified.  The objects packaged are those not\r
132 contained in the union of the given bases.  Each basis can be\r
133 specified explicitly (e.g. <emphasis>^master~10</emphasis>), or implicitly (e.g.\r
134 <emphasis>master~10..master</emphasis>, <emphasis>--since=10.days.ago master</emphasis>).</simpara>\r
135 <simpara>It is very important that the basis used be held by the destination.\r
136 It is okay to err on the side of caution, causing the bundle file\r
137 to contain objects already in the destination, as these are ignored\r
138 when unpacking at the destination.</simpara>\r
139 </simplesect>\r
140 <simplesect id="git-bundle(1)__example">\r
141 <title>EXAMPLE</title>\r
142 <simpara>Assume you want to transfer the history from a repository R1 on machine A\r
143 to another repository R2 on machine B.\r
144 For whatever reason, direct connection between A and B is not allowed,\r
145 but we can move data from A to B via some mechanism (CD, email, etc.).\r
146 We want to update R2 with development made on the branch master in R1.</simpara>\r
147 <simpara>To bootstrap the process, you can first create a bundle that does not have\r
148 any basis. You can use a tag to remember up to what commit you last\r
149 processed, in order to make it easy to later update the other repository\r
150 with an incremental bundle:</simpara>\r
151 <screen>machineA$ cd R1\r
152 machineA$ git bundle create file.bundle master\r
153 machineA$ git tag -f lastR2bundle master</screen>\r
154 <simpara>Then you transfer file.bundle to the target machine B. If you are creating\r
155 the repository on machine B, then you can clone from the bundle as if it\r
156 were a remote repository instead of creating an empty repository and then\r
157 pulling or fetching objects from the bundle:</simpara>\r
158 <screen>machineB$ git clone /home/me/tmp/file.bundle R2</screen>\r
159 <simpara>This will define a remote called "origin" in the resulting repository that\r
160 lets you fetch and pull from the bundle. The $GIT_DIR/config file in R2 will\r
161 have an entry like this:</simpara>\r
162 <screen>[remote "origin"]\r
163     url = /home/me/tmp/file.bundle\r
164     fetch = refs/heads/*:refs/remotes/origin/*</screen>\r
165 <simpara>To update the resulting mine.git repository, you can fetch or pull after\r
166 replacing the bundle stored at /home/me/tmp/file.bundle with incremental\r
167 updates.</simpara>\r
168 <simpara>After working some more in the original repository, you can create an\r
169 incremental bundle to update the other repository:</simpara>\r
170 <screen>machineA$ cd R1\r
171 machineA$ git bundle create file.bundle lastR2bundle..master\r
172 machineA$ git tag -f lastR2bundle master</screen>\r
173 <simpara>You then transfer the bundle to the other machine to replace\r
174 /home/me/tmp/file.bundle, and pull from it.</simpara>\r
175 <screen>machineB$ cd R2\r
176 machineB$ git pull</screen>\r
177 <simpara>If you know up to what commit the intended recipient repository should\r
178 have the necessary objects, you can use that knowledge to specify the\r
179 basis, giving a cut-off point to limit the revisions and objects that go\r
180 in the resulting bundle. The previous example used the lastR2bundle tag\r
181 for this purpose, but you can use any other options that you would give to\r
182 the <xref linkend="git-log(1)" /> command. Here are more examples:</simpara>\r
183 <simpara>You can use a tag that is present in both:</simpara>\r
184 <screen>$ git bundle create mybundle v1.0.0..master</screen>\r
185 <simpara>You can use a basis based on time:</simpara>\r
186 <screen>$ git bundle create mybundle --since=10.days master</screen>\r
187 <simpara>You can use the number of commits:</simpara>\r
188 <screen>$ git bundle create mybundle -10 master</screen>\r
189 <simpara>You can run <emphasis>git-bundle verify</emphasis> to see if you can extract from a bundle\r
190 that was created with a basis:</simpara>\r
191 <screen>$ git bundle verify mybundle</screen>\r
192 <simpara>This will list what commits you must have in order to extract from the\r
193 bundle and will error out if you do not have them.</simpara>\r
194 <simpara>A bundle from a recipient repository's point of view is just like a\r
195 regular repository which it fetches or pulls from. You can, for example, map\r
196 references when fetching:</simpara>\r
197 <screen>$ git fetch mybundle master:localRef</screen>\r
198 <simpara>You can also see what references it offers:</simpara>\r
199 <screen>$ git ls-remote mybundle</screen>\r
200 </simplesect>\r
201 <simplesect id="git-bundle(1)__git">\r
202 <title>GIT</title>\r
203 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>\r
204 </simplesect>\r
205 </sect2>\r