1GIT-BUNDLE(1)                     Git Manual                     GIT-BUNDLE(1)
2
3
4

NAME

6       git-bundle - Move objects and refs by archive
7

SYNOPSIS

9       git bundle create [-q | --quiet | --progress | --all-progress] [--all-progress-implied]
10                           [--version=<version>] <file> <git-rev-list-args>
11       git bundle verify [-q | --quiet] <file>
12       git bundle list-heads <file> [<refname>...]
13       git bundle unbundle [--progress] <file> [<refname>...]
14

DESCRIPTION

16       Create, unpack, and manipulate "bundle" files. Bundles are used for the
17       "offline" transfer of Git objects without an active "server" sitting on
18       the other side of the network connection.
19
20       They can be used to create both incremental and full backups of a
21       repository, and to relay the state of the references in one repository
22       to another.
23
24       Git commands that fetch or otherwise "read" via protocols such as
25       ssh:// and https:// can also operate on bundle files. It is possible
26       git-clone(1) a new repository from a bundle, to use git-fetch(1) to
27       fetch from one, and to list the references contained within it with
28       git-ls-remote(1). There’s no corresponding "write" support, i.e.a git
29       push into a bundle is not supported.
30
31       See the "EXAMPLES" section below for examples of how to use bundles.
32

BUNDLE FORMAT

34       Bundles are .pack files (see git-pack-objects(1)) with a header
35       indicating what references are contained within the bundle.
36
37       Like the packed archive format itself bundles can either be
38       self-contained, or be created using exclusions. See the "OBJECT
39       PREREQUISITES" section below.
40
41       Bundles created using revision exclusions are "thin packs" created
42       using the --thin option to git-pack-objects(1), and unbundled using the
43       --fix-thin option to git-index-pack(1).
44
45       There is no option to create a "thick pack" when using revision
46       exclusions, and users should not be concerned about the difference. By
47       using "thin packs", bundles created using exclusions are smaller in
48       size. That they’re "thin" under the hood is merely noted here as a
49       curiosity, and as a reference to other documentation.
50
51       See gitformat-bundle(5) for more details and the discussion of "thin
52       pack" in gitformat-pack(5) for further details.
53

OPTIONS

55       create [options] <file> <git-rev-list-args>
56           Used to create a bundle named file. This requires the
57           <git-rev-list-args> arguments to define the bundle contents.
58           options contains the options specific to the git bundle create
59           subcommand.
60
61       verify <file>
62           Used to check that a bundle file is valid and will apply cleanly to
63           the current repository. This includes checks on the bundle format
64           itself as well as checking that the prerequisite commits exist and
65           are fully linked in the current repository. Then, git bundle prints
66           a list of missing commits, if any. Finally, information about
67           additional capabilities, such as "object filter", is printed. See
68           "Capabilities" in gitformat-bundle(5) for more information. The
69           exit code is zero for success, but will be nonzero if the bundle
70           file is invalid.
71
72       list-heads <file>
73           Lists the references defined in the bundle. If followed by a list
74           of references, only references matching those given are printed
75           out.
76
77       unbundle <file>
78           Passes the objects in the bundle to git index-pack for storage in
79           the repository, then prints the names of all defined references. If
80           a list of references is given, only references matching those in
81           the list are printed. This command is really plumbing, intended to
82           be called only by git fetch.
83
84       <git-rev-list-args>
85           A list of arguments, acceptable to git rev-parse and git rev-list
86           (and containing a named ref, see SPECIFYING REFERENCES below), that
87           specifies the specific objects and references to transport. For
88           example, master~10..master causes the current master reference to
89           be packaged along with all objects added since its 10th ancestor
90           commit. There is no explicit limit to the number of references and
91           objects that may be packaged.
92
93       [<refname>...]
94           A list of references used to limit the references reported as
95           available. This is principally of use to git fetch, which expects
96           to receive only those references asked for and not necessarily
97           everything in the pack (in this case, git bundle acts like git
98           fetch-pack).
99
100       --progress
101           Progress status is reported on the standard error stream by default
102           when it is attached to a terminal, unless -q is specified. This
103           flag forces progress status even if the standard error stream is
104           not directed to a terminal.
105
106       --all-progress
107           When --stdout is specified then progress report is displayed during
108           the object count and compression phases but inhibited during the
109           write-out phase. The reason is that in some cases the output stream
110           is directly linked to another command which may wish to display
111           progress status of its own as it processes incoming pack data. This
112           flag is like --progress except that it forces progress report for
113           the write-out phase as well even if --stdout is used.
114
115       --all-progress-implied
116           This is used to imply --all-progress whenever progress display is
117           activated. Unlike --all-progress this flag doesn’t actually force
118           any progress display by itself.
119
120       --version=<version>
121           Specify the bundle version. Version 2 is the older format and can
122           only be used with SHA-1 repositories; the newer version 3 contains
123           capabilities that permit extensions. The default is the oldest
124           supported format, based on the hash algorithm in use.
125
126       -q, --quiet
127           This flag makes the command not to report its progress on the
128           standard error stream.
129

SPECIFYING REFERENCES

131       Revisions must be accompanied by reference names to be packaged in a
132       bundle.
133
134       More than one reference may be packaged, and more than one set of
135       prerequisite objects can be specified. The objects packaged are those
136       not contained in the union of the prerequisites.
137
138       The git bundle create command resolves the reference names for you
139       using the same rules as git rev-parse --abbrev-ref=loose. Each
140       prerequisite can be specified explicitly (e.g. ^master~10), or
141       implicitly (e.g. master~10..master, --since=10.days.ago master).
142
143       All of these simple cases are OK (assuming we have a "master" and
144       "next" branch):
145
146           $ git bundle create master.bundle master
147           $ echo master | git bundle create master.bundle --stdin
148           $ git bundle create master-and-next.bundle master next
149           $ (echo master; echo next) | git bundle create master-and-next.bundle --stdin
150
151       And so are these (and the same but omitted --stdin examples):
152
153           $ git bundle create recent-master.bundle master~10..master
154           $ git bundle create recent-updates.bundle master~10..master next~5..next
155
156       A revision name or a range whose right-hand-side cannot be resolved to
157       a reference is not accepted:
158
159           $ git bundle create HEAD.bundle $(git rev-parse HEAD)
160           fatal: Refusing to create empty bundle.
161           $ git bundle create master-yesterday.bundle master~10..master~5
162           fatal: Refusing to create empty bundle.
163

OBJECT PREREQUISITES

165       When creating bundles it is possible to create a self-contained bundle
166       that can be unbundled in a repository with no common history, as well
167       as providing negative revisions to exclude objects needed in the
168       earlier parts of the history.
169
170       Feeding a revision such as new to git bundle create will create a
171       bundle file that contains all the objects reachable from the revision
172       new. That bundle can be unbundled in any repository to obtain a full
173       history that leads to the revision new:
174
175           $ git bundle create full.bundle new
176
177       A revision range such as old..new will produce a bundle file that will
178       require the revision old (and any objects reachable from it) to exist
179       for the bundle to be "unbundle"-able:
180
181           $ git bundle create full.bundle old..new
182
183       A self-contained bundle without any prerequisites can be extracted into
184       anywhere, even into an empty repository, or be cloned from (i.e., new,
185       but not old..new).
186
187       It is okay to err on the side of caution, causing the bundle file to
188       contain objects already in the destination, as these are ignored when
189       unpacking at the destination.
190
191       If you want to match git clone --mirror, which would include your refs
192       such as refs/remotes/*, use --all. If you want to provide the same set
193       of refs that a clone directly from the source repository would get, use
194       --branches --tags for the <git-rev-list-args>.
195
196       The git bundle verify command can be used to check whether your
197       recipient repository has the required prerequisite commits for a
198       bundle.
199

EXAMPLES

201       Assume you want to transfer the history from a repository R1 on machine
202       A to another repository R2 on machine B. For whatever reason, direct
203       connection between A and B is not allowed, but we can move data from A
204       to B via some mechanism (CD, email, etc.). We want to update R2 with
205       development made on the branch master in R1.
206
207       To bootstrap the process, you can first create a bundle that does not
208       have any prerequisites. You can use a tag to remember up to what commit
209       you last processed, in order to make it easy to later update the other
210       repository with an incremental bundle:
211
212           machineA$ cd R1
213           machineA$ git bundle create file.bundle master
214           machineA$ git tag -f lastR2bundle master
215
216       Then you transfer file.bundle to the target machine B. Because this
217       bundle does not require any existing object to be extracted, you can
218       create a new repository on machine B by cloning from it:
219
220           machineB$ git clone -b master /home/me/tmp/file.bundle R2
221
222       This will define a remote called "origin" in the resulting repository
223       that lets you fetch and pull from the bundle. The $GIT_DIR/config file
224       in R2 will have an entry like this:
225
226           [remote "origin"]
227               url = /home/me/tmp/file.bundle
228               fetch = refs/heads/*:refs/remotes/origin/*
229
230       To update the resulting mine.git repository, you can fetch or pull
231       after replacing the bundle stored at /home/me/tmp/file.bundle with
232       incremental updates.
233
234       After working some more in the original repository, you can create an
235       incremental bundle to update the other repository:
236
237           machineA$ cd R1
238           machineA$ git bundle create file.bundle lastR2bundle..master
239           machineA$ git tag -f lastR2bundle master
240
241       You then transfer the bundle to the other machine to replace
242       /home/me/tmp/file.bundle, and pull from it.
243
244           machineB$ cd R2
245           machineB$ git pull
246
247       If you know up to what commit the intended recipient repository should
248       have the necessary objects, you can use that knowledge to specify the
249       prerequisites, giving a cut-off point to limit the revisions and
250       objects that go in the resulting bundle. The previous example used the
251       lastR2bundle tag for this purpose, but you can use any other options
252       that you would give to the git-log(1) command. Here are more examples:
253
254       You can use a tag that is present in both:
255
256           $ git bundle create mybundle v1.0.0..master
257
258       You can use a prerequisite based on time:
259
260           $ git bundle create mybundle --since=10.days master
261
262       You can use the number of commits:
263
264           $ git bundle create mybundle -10 master
265
266       You can run git-bundle verify to see if you can extract from a bundle
267       that was created with a prerequisite:
268
269           $ git bundle verify mybundle
270
271       This will list what commits you must have in order to extract from the
272       bundle and will error out if you do not have them.
273
274       A bundle from a recipient repository’s point of view is just like a
275       regular repository which it fetches or pulls from. You can, for
276       example, map references when fetching:
277
278           $ git fetch mybundle master:localRef
279
280       You can also see what references it offers:
281
282           $ git ls-remote mybundle
283

FILE FORMAT

285       See gitformat-bundle(5).
286

GIT

288       Part of the git(1) suite
289
290
291
292Git 2.39.1                        2023-01-13                     GIT-BUNDLE(1)
Impressum