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 <file> <git-rev-list-args>
10       git bundle verify <file>
11       git bundle list-heads <file> [<refname>...]
12       git bundle unbundle <file> [<refname>...]
13
14

DESCRIPTION

16       Some workflows require that one or more branches of development on one
17       machine be replicated on another machine, but the two machines cannot
18       be directly connected, and therefore the interactive Git protocols
19       (git, ssh, rsync, http) cannot be used. This command provides support
20       for git fetch and git pull to operate by packaging objects and
21       references in an archive at the originating machine, then importing
22       those into another repository using git fetch and git pull after moving
23       the archive by some means (e.g., by sneakernet). As no direct
24       connection between the repositories exists, the user must specify a
25       basis for the bundle that is held by the destination repository: the
26       bundle assumes that all objects in the basis are already in the
27       destination repository.
28

OPTIONS

30       create <file>
31           Used to create a bundle named file. This requires the
32           git-rev-list-args arguments to define the bundle contents.
33
34       verify <file>
35           Used to check that a bundle file is valid and will apply cleanly to
36           the current repository. This includes checks on the bundle format
37           itself as well as checking that the prerequisite commits exist and
38           are fully linked in the current repository.  git bundle prints a
39           list of missing commits, if any, and exits with a non-zero status.
40
41       list-heads <file>
42           Lists the references defined in the bundle. If followed by a list
43           of references, only references matching those given are printed
44           out.
45
46       unbundle <file>
47           Passes the objects in the bundle to git index-pack for storage in
48           the repository, then prints the names of all defined references. If
49           a list of references is given, only references matching those in
50           the list are printed. This command is really plumbing, intended to
51           be called only by git fetch.
52
53       <git-rev-list-args>
54           A list of arguments, acceptable to git rev-parse and git rev-list
55           (and containing a named ref, see SPECIFYING REFERENCES below), that
56           specifies the specific objects and references to transport. For
57           example, master~10..master causes the current master reference to
58           be packaged along with all objects added since its 10th ancestor
59           commit. There is no explicit limit to the number of references and
60           objects that may be packaged.
61
62       [<refname>...]
63           A list of references used to limit the references reported as
64           available. This is principally of use to git fetch, which expects
65           to receive only those references asked for and not necessarily
66           everything in the pack (in this case, git bundle acts like git
67           fetch-pack).
68

SPECIFYING REFERENCES

70       git bundle will only package references that are shown by git show-ref:
71       this includes heads, tags, and remote heads. References such as
72       master~1 cannot be packaged, but are perfectly suitable for defining
73       the basis. More than one reference may be packaged, and more than one
74       basis can be specified. The objects packaged are those not contained in
75       the union of the given bases. Each basis can be specified explicitly
76       (e.g. ^master~10), or implicitly (e.g. master~10..master,
77       --since=10.days.ago master).
78
79       It is very important that the basis used be held by the destination. It
80       is okay to err on the side of caution, causing the bundle file to
81       contain objects already in the destination, as these are ignored when
82       unpacking at the destination.
83

EXAMPLE

85       Assume you want to transfer the history from a repository R1 on machine
86       A to another repository R2 on machine B. For whatever reason, direct
87       connection between A and B is not allowed, but we can move data from A
88       to B via some mechanism (CD, email, etc.). We want to update R2 with
89       development made on the branch master in R1.
90
91       To bootstrap the process, you can first create a bundle that does not
92       have any basis. You can use a tag to remember up to what commit you
93       last processed, in order to make it easy to later update the other
94       repository with an incremental bundle:
95
96           machineA$ cd R1
97           machineA$ git bundle create file.bundle master
98           machineA$ git tag -f lastR2bundle master
99
100
101       Then you transfer file.bundle to the target machine B. Because this
102       bundle does not require any existing object to be extracted, you can
103       create a new repository on machine B by cloning from it:
104
105           machineB$ git clone -b master /home/me/tmp/file.bundle R2
106
107
108       This will define a remote called "origin" in the resulting repository
109       that lets you fetch and pull from the bundle. The $GIT_DIR/config file
110       in R2 will have an entry like this:
111
112           [remote "origin"]
113               url = /home/me/tmp/file.bundle
114               fetch = refs/heads/*:refs/remotes/origin/*
115
116
117       To update the resulting mine.git repository, you can fetch or pull
118       after replacing the bundle stored at /home/me/tmp/file.bundle with
119       incremental updates.
120
121       After working some more in the original repository, you can create an
122       incremental bundle to update the other repository:
123
124           machineA$ cd R1
125           machineA$ git bundle create file.bundle lastR2bundle..master
126           machineA$ git tag -f lastR2bundle master
127
128
129       You then transfer the bundle to the other machine to replace
130       /home/me/tmp/file.bundle, and pull from it.
131
132           machineB$ cd R2
133           machineB$ git pull
134
135
136       If you know up to what commit the intended recipient repository should
137       have the necessary objects, you can use that knowledge to specify the
138       basis, giving a cut-off point to limit the revisions and objects that
139       go in the resulting bundle. The previous example used the lastR2bundle
140       tag for this purpose, but you can use any other options that you would
141       give to the git-log(1) command. Here are more examples:
142
143       You can use a tag that is present in both:
144
145           $ git bundle create mybundle v1.0.0..master
146
147
148       You can use a basis based on time:
149
150           $ git bundle create mybundle --since=10.days master
151
152
153       You can use the number of commits:
154
155           $ git bundle create mybundle -10 master
156
157
158       You can run git-bundle verify to see if you can extract from a bundle
159       that was created with a basis:
160
161           $ git bundle verify mybundle
162
163
164       This will list what commits you must have in order to extract from the
165       bundle and will error out if you do not have them.
166
167       A bundle from a recipient repository’s point of view is just like a
168       regular repository which it fetches or pulls from. You can, for
169       example, map references when fetching:
170
171           $ git fetch mybundle master:localRef
172
173
174       You can also see what references it offers:
175
176           $ git ls-remote mybundle
177
178

GIT

180       Part of the git(1) suite
181
182
183
184Git 1.8.3.1                       11/19/2018                     GIT-BUNDLE(1)
Impressum