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

DESCRIPTION

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

OPTIONS

31       create [options] <file> <git-rev-list-args>
32           Used to create a bundle named file. This requires the
33           <git-rev-list-args> arguments to define the bundle contents.
34           options contains the options specific to the git bundle create
35           subcommand.
36
37       verify <file>
38           Used to check that a bundle file is valid and will apply cleanly to
39           the current repository. This includes checks on the bundle format
40           itself as well as checking that the prerequisite commits exist and
41           are fully linked in the current repository.  git bundle prints a
42           list of missing commits, if any, and exits with a non-zero status.
43
44       list-heads <file>
45           Lists the references defined in the bundle. If followed by a list
46           of references, only references matching those given are printed
47           out.
48
49       unbundle <file>
50           Passes the objects in the bundle to git index-pack for storage in
51           the repository, then prints the names of all defined references. If
52           a list of references is given, only references matching those in
53           the list are printed. This command is really plumbing, intended to
54           be called only by git fetch.
55
56       <git-rev-list-args>
57           A list of arguments, acceptable to git rev-parse and git rev-list
58           (and containing a named ref, see SPECIFYING REFERENCES below), that
59           specifies the specific objects and references to transport. For
60           example, master~10..master causes the current master reference to
61           be packaged along with all objects added since its 10th ancestor
62           commit. There is no explicit limit to the number of references and
63           objects that may be packaged.
64
65       [<refname>...]
66           A list of references used to limit the references reported as
67           available. This is principally of use to git fetch, which expects
68           to receive only those references asked for and not necessarily
69           everything in the pack (in this case, git bundle acts like git
70           fetch-pack).
71
72       --progress
73           Progress status is reported on the standard error stream by default
74           when it is attached to a terminal, unless -q is specified. This
75           flag forces progress status even if the standard error stream is
76           not directed to a terminal.
77
78       --all-progress
79           When --stdout is specified then progress report is displayed during
80           the object count and compression phases but inhibited during the
81           write-out phase. The reason is that in some cases the output stream
82           is directly linked to another command which may wish to display
83           progress status of its own as it processes incoming pack data. This
84           flag is like --progress except that it forces progress report for
85           the write-out phase as well even if --stdout is used.
86
87       --all-progress-implied
88           This is used to imply --all-progress whenever progress display is
89           activated. Unlike --all-progress this flag doesn’t actually force
90           any progress display by itself.
91
92       -q, --quiet
93           This flag makes the command not to report its progress on the
94           standard error stream.
95

SPECIFYING REFERENCES

97       git bundle will only package references that are shown by git show-ref:
98       this includes heads, tags, and remote heads. References such as
99       master~1 cannot be packaged, but are perfectly suitable for defining
100       the basis. More than one reference may be packaged, and more than one
101       basis can be specified. The objects packaged are those not contained in
102       the union of the given bases. Each basis can be specified explicitly
103       (e.g. ^master~10), or implicitly (e.g. master~10..master,
104       --since=10.days.ago master).
105
106       It is very important that the basis used be held by the destination. It
107       is okay to err on the side of caution, causing the bundle file to
108       contain objects already in the destination, as these are ignored when
109       unpacking at the destination.
110
111       git clone can use any bundle created without negative refspecs (e.g.,
112       new, but not old..new). If you want to match git clone --mirror, which
113       would include your refs such as refs/remotes/*, use --all. If you want
114       to provide the same set of refs that a clone directly from the source
115       repository would get, use --branches --tags for the
116       <git-rev-list-args>.
117

EXAMPLES

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

GIT

203       Part of the git(1) suite
204
205
206
207Git 2.26.2                        2020-04-20                     GIT-BUNDLE(1)
Impressum