3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
7 .\" Source: Git 2.44.0.568.g436d4e5b14
10 .TH "GIT\-BUNDLE" "1" "2024\-04\-10" "Git 2\&.44\&.0\&.568\&.g436d4e" "Git Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 git-bundle \- Move objects and refs by archive
35 \fIgit bundle\fR create [\-q | \-\-quiet | \-\-progress]
36 [\-\-version=<version>] <file> <git\-rev\-list\-args>
37 \fIgit bundle\fR verify [\-q | \-\-quiet] <file>
38 \fIgit bundle\fR list\-heads <file> [<refname>\&...]
39 \fIgit bundle\fR unbundle [\-\-progress] <file> [<refname>\&...]
44 Create, unpack, and manipulate "bundle" files\&. Bundles are used for the "offline" transfer of Git objects without an active "server" sitting on the other side of the network connection\&.
46 They can be used to create both incremental and full backups of a repository, and to relay the state of the references in one repository to another\&.
48 Git commands that fetch or otherwise "read" via protocols such as \fBssh://\fR and \fBhttps://\fR can also operate on bundle files\&. It is possible \fBgit-clone\fR(1) a new repository from a bundle, to use \fBgit-fetch\fR(1) to fetch from one, and to list the references contained within it with \fBgit-ls-remote\fR(1)\&. There\(cqs no corresponding "write" support, i\&.e\&.a \fIgit push\fR into a bundle is not supported\&.
50 See the "EXAMPLES" section below for examples of how to use bundles\&.
53 Bundles are \fB\&.pack\fR files (see \fBgit-pack-objects\fR(1)) with a header indicating what references are contained within the bundle\&.
55 Like the packed archive format itself bundles can either be self\-contained, or be created using exclusions\&. See the "OBJECT PREREQUISITES" section below\&.
57 Bundles created using revision exclusions are "thin packs" created using the \fB\-\-thin\fR option to \fBgit-pack-objects\fR(1), and unbundled using the \fB\-\-fix\-thin\fR option to \fBgit-index-pack\fR(1)\&.
59 There is no option to create a "thick pack" when using revision exclusions, and users should not be concerned about the difference\&. By using "thin packs", bundles created using exclusions are smaller in size\&. That they\(cqre "thin" under the hood is merely noted here as a curiosity, and as a reference to other documentation\&.
61 See \fBgitformat-bundle\fR(5) for more details and the discussion of "thin pack" in \fBgitformat-pack\fR(5) for further details\&.
64 create [options] <file> <git\-rev\-list\-args>
66 Used to create a bundle named
67 \fIfile\fR\&. This requires the
68 \fI<git\-rev\-list\-args>\fR
69 arguments to define the bundle contents\&.
71 contains the options specific to the
72 \fIgit bundle create\fR
76 \fB\-\fR, the bundle is written to stdout\&.
81 Used to check that a bundle file is valid and will apply cleanly to the current repository\&. This includes checks on the bundle format itself as well as checking that the prerequisite commits exist and are fully linked in the current repository\&. Then,
83 prints a list of missing commits, if any\&. Finally, information about additional capabilities, such as "object filter", is printed\&. See "Capabilities" in
84 \fBgitformat-bundle\fR(5)
85 for more information\&. The exit code is zero for success, but will be nonzero if the bundle file is invalid\&. If
88 \fB\-\fR, the bundle is read from stdin\&.
93 Lists the references defined in the bundle\&. If followed by a list of references, only references matching those given are printed out\&. If
96 \fB\-\fR, the bundle is read from stdin\&.
101 Passes the objects in the bundle to
102 \fIgit index\-pack\fR
103 for storage in the repository, then prints the names of all defined references\&. If a list of references is given, only references matching those in the list are printed\&. This command is really plumbing, intended to be called only by
104 \fIgit fetch\fR\&. If
107 \fB\-\fR, the bundle is read from stdin\&.
110 <git\-rev\-list\-args>
112 A list of arguments, acceptable to
116 (and containing a named ref, see SPECIFYING REFERENCES below), that specifies the specific objects and references to transport\&. For example,
117 \fBmaster~10\&.\&.master\fR
118 causes the current master reference to be packaged along with all objects added since its 10th ancestor commit\&. There is no explicit limit to the number of references and objects that may be packaged\&.
123 A list of references used to limit the references reported as available\&. This is principally of use to
124 \fIgit fetch\fR, which expects to receive only those references asked for and not necessarily everything in the pack (in this case,
127 \fIgit fetch\-pack\fR)\&.
132 Progress status is reported on the standard error stream by default when it is attached to a terminal, unless \-q is specified\&. This flag forces progress status even if the standard error stream is not directed to a terminal\&.
135 \-\-version=<version>
137 Specify the bundle version\&. Version 2 is the older format and can only be used with SHA\-1 repositories; the newer version 3 contains capabilities that permit extensions\&. The default is the oldest supported format, based on the hash algorithm in use\&.
142 This flag makes the command not to report its progress on the standard error stream\&.
144 .SH "SPECIFYING REFERENCES"
146 Revisions must be accompanied by reference names to be packaged in a bundle\&.
148 More than one reference may be packaged, and more than one set of prerequisite objects can be specified\&. The objects packaged are those not contained in the union of the prerequisites\&.
150 The \fIgit bundle create\fR command resolves the reference names for you using the same rules as \fBgit rev\-parse \-\-abbrev\-ref=loose\fR\&. Each prerequisite can be specified explicitly (e\&.g\&. \fB^master~10\fR), or implicitly (e\&.g\&. \fBmaster~10\&.\&.master\fR, \fB\-\-since=10\&.days\&.ago master\fR)\&.
152 All of these simple cases are OK (assuming we have a "master" and "next" branch):
158 $ git bundle create master\&.bundle master
159 $ echo master | git bundle create master\&.bundle \-\-stdin
160 $ git bundle create master\-and\-next\&.bundle master next
161 $ (echo master; echo next) | git bundle create master\-and\-next\&.bundle \-\-stdin
168 And so are these (and the same but omitted \fB\-\-stdin\fR examples):
174 $ git bundle create recent\-master\&.bundle master~10\&.\&.master
175 $ git bundle create recent\-updates\&.bundle master~10\&.\&.master next~5\&.\&.next
182 A revision name or a range whose right\-hand\-side cannot be resolved to a reference is not accepted:
188 $ git bundle create HEAD\&.bundle $(git rev\-parse HEAD)
189 fatal: Refusing to create empty bundle\&.
190 $ git bundle create master\-yesterday\&.bundle master~10\&.\&.master~5
191 fatal: Refusing to create empty bundle\&.
197 .SH "OBJECT PREREQUISITES"
199 When creating bundles it is possible to create a self\-contained bundle that can be unbundled in a repository with no common history, as well as providing negative revisions to exclude objects needed in the earlier parts of the history\&.
201 Feeding a revision such as \fBnew\fR to \fBgit bundle create\fR will create a bundle file that contains all the objects reachable from the revision \fBnew\fR\&. That bundle can be unbundled in any repository to obtain a full history that leads to the revision \fBnew\fR:
207 $ git bundle create full\&.bundle new
214 A revision range such as \fBold\&.\&.new\fR will produce a bundle file that will require the revision \fBold\fR (and any objects reachable from it) to exist for the bundle to be "unbundle"\-able:
220 $ git bundle create full\&.bundle old\&.\&.new
227 A self\-contained bundle without any prerequisites can be extracted into anywhere, even into an empty repository, or be cloned from (i\&.e\&., \fBnew\fR, but not \fBold\&.\&.new\fR)\&.
229 It is okay to err on the side of caution, causing the bundle file to contain objects already in the destination, as these are ignored when unpacking at the destination\&.
231 If you want to match \fBgit clone \-\-mirror\fR, which would include your refs such as \fBrefs/remotes/*\fR, use \fB\-\-all\fR\&. If you want to provide the same set of refs that a clone directly from the source repository would get, use \fB\-\-branches \-\-tags\fR for the \fB<git\-rev\-list\-args>\fR\&.
233 The \fIgit bundle verify\fR command can be used to check whether your recipient repository has the required prerequisite commits for a bundle\&.
236 Assume you want to transfer the history from a repository R1 on machine A to another repository R2 on machine B\&. For whatever reason, direct connection between A and B is not allowed, but we can move data from A to B via some mechanism (CD, email, etc\&.)\&. We want to update R2 with development made on the branch master in R1\&.
238 To bootstrap the process, you can first create a bundle that does not have any prerequisites\&. You can use a tag to remember up to what commit you last processed, in order to make it easy to later update the other repository with an incremental bundle:
245 machineA$ git bundle create file\&.bundle master
246 machineA$ git tag \-f lastR2bundle master
253 Then you transfer file\&.bundle to the target machine B\&. Because this bundle does not require any existing object to be extracted, you can create a new repository on machine B by cloning from it:
259 machineB$ git clone \-b master /home/me/tmp/file\&.bundle R2
266 This will define a remote called "origin" in the resulting repository that lets you fetch and pull from the bundle\&. The $GIT_DIR/config file in R2 will have an entry like this:
273 url = /home/me/tmp/file\&.bundle
274 fetch = refs/heads/*:refs/remotes/origin/*
281 To update the resulting mine\&.git repository, you can fetch or pull after replacing the bundle stored at /home/me/tmp/file\&.bundle with incremental updates\&.
283 After working some more in the original repository, you can create an incremental bundle to update the other repository:
290 machineA$ git bundle create file\&.bundle lastR2bundle\&.\&.master
291 machineA$ git tag \-f lastR2bundle master
298 You then transfer the bundle to the other machine to replace /home/me/tmp/file\&.bundle, and pull from it\&.
312 If you know up to what commit the intended recipient repository should have the necessary objects, you can use that knowledge to specify the prerequisites, giving a cut\-off point to limit the revisions and objects that go in the resulting bundle\&. The previous example used the lastR2bundle tag for this purpose, but you can use any other options that you would give to the \fBgit-log\fR(1) command\&. Here are more examples:
314 You can use a tag that is present in both:
320 $ git bundle create mybundle v1\&.0\&.0\&.\&.master
327 You can use a prerequisite based on time:
333 $ git bundle create mybundle \-\-since=10\&.days master
340 You can use the number of commits:
346 $ git bundle create mybundle \-10 master
353 You can run \fBgit\-bundle verify\fR to see if you can extract from a bundle that was created with a prerequisite:
359 $ git bundle verify mybundle
366 This will list what commits you must have in order to extract from the bundle and will error out if you do not have them\&.
368 A bundle from a recipient repository\(cqs point of view is just like a regular repository which it fetches or pulls from\&. You can, for example, map references when fetching:
374 $ git fetch mybundle master:localRef
381 You can also see what references it offers:
387 $ git ls\-remote mybundle
395 See \fBgitformat-bundle\fR(5)\&.
398 Part of the \fBgit\fR(1) suite