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, http) cannot be used. This command provides support for git
20       fetch and git pull to operate by packaging objects and references in an
21       archive at the originating machine, then importing those into another
22       repository using git fetch and git pull after moving the archive by
23       some means (e.g., by sneakernet). As no direct connection between the
24       repositories exists, the user must specify a basis for the bundle that
25       is held by the destination repository: the bundle assumes that all
26       objects in the basis are already in the destination repository.
27

OPTIONS

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

SPECIFYING REFERENCES

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

EXAMPLES

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

GIT

179       Part of the git(1) suite
180
181
182
183Git 2.18.1                        05/14/2019                     GIT-BUNDLE(1)
Impressum