OSDN Git Service

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