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 git rev-list
32           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           that specifies the specific objects and references to transport.
56           For example, master\~10..master causes the current master reference
57           to 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

EXAMPLE

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. If you are
101       creating the repository on machine B, then you can clone from the
102       bundle as if it were a remote repository instead of creating an empty
103       repository and then pulling or fetching objects from the bundle:
104
105           machineB$ git clone /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 lastR2bundle tag
140       for this purpose, but you can use any other options that you would give
141       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

AUTHOR

180       Written by Mark Levedahl <mdl123@verizon.net[1]>
181

GIT

183       Part of the git(1) suite
184

NOTES

186        1. mdl123@verizon.net
187           mailto:mdl123@verizon.net
188
189
190
191Git 1.7.1                         08/16/2017                     GIT-BUNDLE(1)
Impressum