6 git-bundle - Move objects and refs by archive
12 'git bundle' create [-q | --quiet | --progress | --all-progress] [--all-progress-implied] <file> <git-rev-list-args>
13 'git bundle' verify [-q | --quiet] <file>
14 'git bundle' list-heads <file> [<refname>...]
15 'git bundle' unbundle <file> [<refname>...]
20 Some workflows require that one or more branches of development on one
21 machine be replicated on another machine, but the two machines cannot
22 be directly connected, and therefore the interactive Git protocols (git,
23 ssh, http) cannot be used. This command provides support for
24 'git fetch' and 'git pull' to operate by packaging objects and references
25 in an archive at the originating machine, then importing those into
26 another repository using 'git fetch' and 'git pull'
27 after moving the archive by some means (e.g., by sneakernet). As no
28 direct connection between the repositories exists, the user must specify a
29 basis for the bundle that is held by the destination repository: the
30 bundle assumes that all objects in the basis are already in the
31 destination repository.
36 create [options] <file> <git-rev-list-args>::
37 Used to create a bundle named 'file'. This requires the
38 'git-rev-list-args' arguments to define the bundle contents.
39 'options' contains the options specific to the 'git bundle create'
43 Used to check that a bundle file is valid and will apply
44 cleanly to the current repository. This includes checks on the
45 bundle format itself as well as checking that the prerequisite
46 commits exist and are fully linked in the current repository.
47 'git bundle' prints a list of missing commits, if any, and exits
48 with a non-zero status.
51 Lists the references defined in the bundle. If followed by a
52 list of references, only references matching those given are
56 Passes the objects in the bundle to 'git index-pack'
57 for storage in the repository, then prints the names of all
58 defined references. If a list of references is given, only
59 references matching those in the list are printed. This command is
60 really plumbing, intended to be called only by 'git fetch'.
63 A list of arguments, acceptable to 'git rev-parse' and
64 'git rev-list' (and containing a named ref, see SPECIFYING REFERENCES
65 below), that specifies the specific objects and references
66 to transport. For example, `master~10..master` causes the
67 current master reference to be packaged along with all objects
68 added since its 10th ancestor commit. There is no explicit
69 limit to the number of references and objects that may be
74 A list of references used to limit the references reported as
75 available. This is principally of use to 'git fetch', which
76 expects to receive only those references asked for and not
77 necessarily everything in the pack (in this case, 'git bundle' acts
78 like 'git fetch-pack').
81 Progress status is reported on the standard error stream
82 by default when it is attached to a terminal, unless -q
83 is specified. This flag forces progress status even if
84 the standard error stream is not directed to a terminal.
87 When --stdout is specified then progress report is
88 displayed during the object count and compression phases
89 but inhibited during the write-out phase. The reason is
90 that in some cases the output stream is directly linked
91 to another command which may wish to display progress
92 status of its own as it processes incoming pack data.
93 This flag is like --progress except that it forces progress
94 report for the write-out phase as well even if --stdout is
97 --all-progress-implied::
98 This is used to imply --all-progress whenever progress display
99 is activated. Unlike --all-progress this flag doesn't actually
100 force any progress display by itself.
104 This flag makes the command not to report its progress
105 on the standard error stream.
107 SPECIFYING REFERENCES
108 ---------------------
110 'git bundle' will only package references that are shown by
111 'git show-ref': this includes heads, tags, and remote heads. References
112 such as `master~1` cannot be packaged, but are perfectly suitable for
113 defining the basis. More than one reference may be packaged, and more
114 than one basis can be specified. The objects packaged are those not
115 contained in the union of the given bases. Each basis can be
116 specified explicitly (e.g. `^master~10`), or implicitly (e.g.
117 `master~10..master`, `--since=10.days.ago master`).
119 It is very important that the basis used be held by the destination.
120 It is okay to err on the side of caution, causing the bundle file
121 to contain objects already in the destination, as these are ignored
122 when unpacking at the destination.
127 Assume you want to transfer the history from a repository R1 on machine A
128 to another repository R2 on machine B.
129 For whatever reason, direct connection between A and B is not allowed,
130 but we can move data from A to B via some mechanism (CD, email, etc.).
131 We want to update R2 with development made on the branch master in R1.
133 To bootstrap the process, you can first create a bundle that does not have
134 any basis. You can use a tag to remember up to what commit you last
135 processed, in order to make it easy to later update the other repository
136 with an incremental bundle:
140 machineA$ git bundle create file.bundle master
141 machineA$ git tag -f lastR2bundle master
144 Then you transfer file.bundle to the target machine B. Because this
145 bundle does not require any existing object to be extracted, you can
146 create a new repository on machine B by cloning from it:
149 machineB$ git clone -b master /home/me/tmp/file.bundle R2
152 This will define a remote called "origin" in the resulting repository that
153 lets you fetch and pull from the bundle. The $GIT_DIR/config file in R2 will
154 have an entry like this:
156 ------------------------
158 url = /home/me/tmp/file.bundle
159 fetch = refs/heads/*:refs/remotes/origin/*
160 ------------------------
162 To update the resulting mine.git repository, you can fetch or pull after
163 replacing the bundle stored at /home/me/tmp/file.bundle with incremental
166 After working some more in the original repository, you can create an
167 incremental bundle to update the other repository:
171 machineA$ git bundle create file.bundle lastR2bundle..master
172 machineA$ git tag -f lastR2bundle master
175 You then transfer the bundle to the other machine to replace
176 /home/me/tmp/file.bundle, and pull from it.
183 If you know up to what commit the intended recipient repository should
184 have the necessary objects, you can use that knowledge to specify the
185 basis, giving a cut-off point to limit the revisions and objects that go
186 in the resulting bundle. The previous example used the lastR2bundle tag
187 for this purpose, but you can use any other options that you would give to
188 the linkgit:git-log[1] command. Here are more examples:
190 You can use a tag that is present in both:
193 $ git bundle create mybundle v1.0.0..master
196 You can use a basis based on time:
199 $ git bundle create mybundle --since=10.days master
202 You can use the number of commits:
205 $ git bundle create mybundle -10 master
208 You can run `git-bundle verify` to see if you can extract from a bundle
209 that was created with a basis:
212 $ git bundle verify mybundle
215 This will list what commits you must have in order to extract from the
216 bundle and will error out if you do not have them.
218 A bundle from a recipient repository's point of view is just like a
219 regular repository which it fetches or pulls from. You can, for example, map
220 references when fetching:
223 $ git fetch mybundle master:localRef
226 You can also see what references it offers:
229 $ git ls-remote mybundle
234 Part of the linkgit:git[1] suite