]>
Commit | Line | Data |
---|---|---|
2e0afafe JS |
1 | git-bundle(1) |
2 | ============= | |
3 | ||
4 | NAME | |
5 | ---- | |
6 | git-bundle - Move objects and refs by archive | |
7 | ||
8 | ||
9 | SYNOPSIS | |
10 | -------- | |
e448ff87 | 11 | [verse] |
79862b6b | 12 | 'git bundle' create [-q | --quiet | --progress | --all-progress] [--all-progress-implied] <file> <git-rev-list-args> |
e0eba649 | 13 | 'git bundle' verify [-q | --quiet] <file> |
62b4698e ŠN |
14 | 'git bundle' list-heads <file> [<refname>...] |
15 | 'git bundle' unbundle <file> [<refname>...] | |
2e0afafe JS |
16 | |
17 | DESCRIPTION | |
18 | ----------- | |
19 | ||
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 | |
2de9b711 | 22 | be directly connected, and therefore the interactive Git protocols (git, |
0e40a73a PO |
23 | ssh, http) cannot be used. |
24 | ||
25 | The 'git bundle' command packages objects and references in an archive | |
26 | at the originating machine, which can then be imported into another | |
27 | repository using 'git fetch', 'git pull', or 'git clone', | |
28 | after moving the archive by some means (e.g., by sneakernet). | |
29 | ||
30 | As no | |
1d52b026 | 31 | direct connection between the repositories exists, the user must specify a |
2e0afafe JS |
32 | basis for the bundle that is held by the destination repository: the |
33 | bundle assumes that all objects in the basis are already in the | |
34 | destination repository. | |
35 | ||
36 | OPTIONS | |
37 | ------- | |
38 | ||
79862b6b | 39 | create [options] <file> <git-rev-list-args>:: |
a6190565 | 40 | Used to create a bundle named 'file'. This requires the |
0e40a73a | 41 | '<git-rev-list-args>' arguments to define the bundle contents. |
79862b6b RJ |
42 | 'options' contains the options specific to the 'git bundle create' |
43 | subcommand. | |
2e0afafe JS |
44 | |
45 | verify <file>:: | |
a6190565 MG |
46 | Used to check that a bundle file is valid and will apply |
47 | cleanly to the current repository. This includes checks on the | |
48 | bundle format itself as well as checking that the prerequisite | |
49 | commits exist and are fully linked in the current repository. | |
50 | 'git bundle' prints a list of missing commits, if any, and exits | |
51 | with a non-zero status. | |
2e0afafe JS |
52 | |
53 | list-heads <file>:: | |
a6190565 MG |
54 | Lists the references defined in the bundle. If followed by a |
55 | list of references, only references matching those given are | |
56 | printed out. | |
2e0afafe JS |
57 | |
58 | unbundle <file>:: | |
a6190565 MG |
59 | Passes the objects in the bundle to 'git index-pack' |
60 | for storage in the repository, then prints the names of all | |
61 | defined references. If a list of references is given, only | |
62 | references matching those in the list are printed. This command is | |
63 | really plumbing, intended to be called only by 'git fetch'. | |
2e0afafe | 64 | |
5e1f9605 | 65 | <git-rev-list-args>:: |
a6190565 | 66 | A list of arguments, acceptable to 'git rev-parse' and |
469bfc96 | 67 | 'git rev-list' (and containing a named ref, see SPECIFYING REFERENCES |
1884df1a | 68 | below), that specifies the specific objects and references |
6cf378f0 | 69 | to transport. For example, `master~10..master` causes the |
a6190565 MG |
70 | current master reference to be packaged along with all objects |
71 | added since its 10th ancestor commit. There is no explicit | |
72 | limit to the number of references and objects that may be | |
73 | packaged. | |
2e0afafe JS |
74 | |
75 | ||
62b4698e | 76 | [<refname>...]:: |
a6190565 MG |
77 | A list of references used to limit the references reported as |
78 | available. This is principally of use to 'git fetch', which | |
79 | expects to receive only those references asked for and not | |
80 | necessarily everything in the pack (in this case, 'git bundle' acts | |
81 | like 'git fetch-pack'). | |
2e0afafe | 82 | |
79862b6b RJ |
83 | --progress:: |
84 | Progress status is reported on the standard error stream | |
85 | by default when it is attached to a terminal, unless -q | |
86 | is specified. This flag forces progress status even if | |
87 | the standard error stream is not directed to a terminal. | |
88 | ||
89 | --all-progress:: | |
90 | When --stdout is specified then progress report is | |
91 | displayed during the object count and compression phases | |
92 | but inhibited during the write-out phase. The reason is | |
93 | that in some cases the output stream is directly linked | |
94 | to another command which may wish to display progress | |
95 | status of its own as it processes incoming pack data. | |
96 | This flag is like --progress except that it forces progress | |
97 | report for the write-out phase as well even if --stdout is | |
98 | used. | |
99 | ||
100 | --all-progress-implied:: | |
101 | This is used to imply --all-progress whenever progress display | |
102 | is activated. Unlike --all-progress this flag doesn't actually | |
103 | force any progress display by itself. | |
104 | ||
105 | -q:: | |
106 | --quiet:: | |
107 | This flag makes the command not to report its progress | |
108 | on the standard error stream. | |
109 | ||
2e0afafe JS |
110 | SPECIFYING REFERENCES |
111 | --------------------- | |
112 | ||
0b444cdb TR |
113 | 'git bundle' will only package references that are shown by |
114 | 'git show-ref': this includes heads, tags, and remote heads. References | |
6cf378f0 | 115 | such as `master~1` cannot be packaged, but are perfectly suitable for |
2e0afafe JS |
116 | defining the basis. More than one reference may be packaged, and more |
117 | than one basis can be specified. The objects packaged are those not | |
118 | contained in the union of the given bases. Each basis can be | |
6cf378f0 JK |
119 | specified explicitly (e.g. `^master~10`), or implicitly (e.g. |
120 | `master~10..master`, `--since=10.days.ago master`). | |
2e0afafe JS |
121 | |
122 | It is very important that the basis used be held by the destination. | |
1d52b026 DM |
123 | It is okay to err on the side of caution, causing the bundle file |
124 | to contain objects already in the destination, as these are ignored | |
2e0afafe JS |
125 | when unpacking at the destination. |
126 | ||
0e40a73a PO |
127 | `git clone` can use any bundle created without negative refspecs |
128 | (e.g., `new`, but not `old..new`). | |
129 | If you want to match `git clone --mirror`, which would include your | |
130 | refs such as `refs/remotes/*`, use `--all`. | |
131 | If you want to provide the same set of refs that a clone directly | |
132 | from the source repository would get, use `--branches --tags` for | |
133 | the `<git-rev-list-args>`. | |
134 | ||
76a8788c NTND |
135 | EXAMPLES |
136 | -------- | |
2e0afafe | 137 | |
8aa7eebf NS |
138 | Assume you want to transfer the history from a repository R1 on machine A |
139 | to another repository R2 on machine B. | |
2e0afafe | 140 | For whatever reason, direct connection between A and B is not allowed, |
1d52b026 DM |
141 | but we can move data from A to B via some mechanism (CD, email, etc.). |
142 | We want to update R2 with development made on the branch master in R1. | |
99d8ea2c | 143 | |
1d52b026 DM |
144 | To bootstrap the process, you can first create a bundle that does not have |
145 | any basis. You can use a tag to remember up to what commit you last | |
146 | processed, in order to make it easy to later update the other repository | |
147 | with an incremental bundle: | |
99d8ea2c | 148 | |
8aa7eebf NS |
149 | ---------------- |
150 | machineA$ cd R1 | |
ffe4da15 | 151 | machineA$ git bundle create file.bundle master |
8aa7eebf NS |
152 | machineA$ git tag -f lastR2bundle master |
153 | ---------------- | |
99d8ea2c | 154 | |
b5fb4770 JH |
155 | Then you transfer file.bundle to the target machine B. Because this |
156 | bundle does not require any existing object to be extracted, you can | |
157 | create a new repository on machine B by cloning from it: | |
99d8ea2c | 158 | |
8aa7eebf | 159 | ---------------- |
ded6aa6b | 160 | machineB$ git clone -b master /home/me/tmp/file.bundle R2 |
8aa7eebf | 161 | ---------------- |
2e0afafe | 162 | |
8aa7eebf | 163 | This will define a remote called "origin" in the resulting repository that |
1d52b026 | 164 | lets you fetch and pull from the bundle. The $GIT_DIR/config file in R2 will |
8aa7eebf | 165 | have an entry like this: |
2e0afafe | 166 | |
8aa7eebf NS |
167 | ------------------------ |
168 | [remote "origin"] | |
ffe4da15 | 169 | url = /home/me/tmp/file.bundle |
8aa7eebf NS |
170 | fetch = refs/heads/*:refs/remotes/origin/* |
171 | ------------------------ | |
172 | ||
1d52b026 DM |
173 | To update the resulting mine.git repository, you can fetch or pull after |
174 | replacing the bundle stored at /home/me/tmp/file.bundle with incremental | |
175 | updates. | |
8aa7eebf | 176 | |
1d52b026 DM |
177 | After working some more in the original repository, you can create an |
178 | incremental bundle to update the other repository: | |
8aa7eebf NS |
179 | |
180 | ---------------- | |
181 | machineA$ cd R1 | |
ffe4da15 | 182 | machineA$ git bundle create file.bundle lastR2bundle..master |
8aa7eebf NS |
183 | machineA$ git tag -f lastR2bundle master |
184 | ---------------- | |
185 | ||
1d52b026 DM |
186 | You then transfer the bundle to the other machine to replace |
187 | /home/me/tmp/file.bundle, and pull from it. | |
8aa7eebf NS |
188 | |
189 | ---------------- | |
190 | machineB$ cd R2 | |
191 | machineB$ git pull | |
192 | ---------------- | |
99d8ea2c | 193 | |
8aa7eebf | 194 | If you know up to what commit the intended recipient repository should |
1d52b026 | 195 | have the necessary objects, you can use that knowledge to specify the |
8aa7eebf | 196 | basis, giving a cut-off point to limit the revisions and objects that go |
5e1f9605 | 197 | in the resulting bundle. The previous example used the lastR2bundle tag |
1d52b026 | 198 | for this purpose, but you can use any other options that you would give to |
8aa7eebf | 199 | the linkgit:git-log[1] command. Here are more examples: |
99d8ea2c | 200 | |
1d52b026 | 201 | You can use a tag that is present in both: |
99d8ea2c | 202 | |
8aa7eebf NS |
203 | ---------------- |
204 | $ git bundle create mybundle v1.0.0..master | |
205 | ---------------- | |
2e0afafe | 206 | |
1d52b026 | 207 | You can use a basis based on time: |
ee8245b5 | 208 | |
8aa7eebf NS |
209 | ---------------- |
210 | $ git bundle create mybundle --since=10.days master | |
211 | ---------------- | |
2e0afafe | 212 | |
1d52b026 | 213 | You can use the number of commits: |
2e0afafe | 214 | |
8aa7eebf NS |
215 | ---------------- |
216 | $ git bundle create mybundle -10 master | |
217 | ---------------- | |
218 | ||
219 | You can run `git-bundle verify` to see if you can extract from a bundle | |
1d52b026 | 220 | that was created with a basis: |
8aa7eebf NS |
221 | |
222 | ---------------- | |
b1889c36 | 223 | $ git bundle verify mybundle |
8aa7eebf | 224 | ---------------- |
2e0afafe | 225 | |
8aa7eebf | 226 | This will list what commits you must have in order to extract from the |
1d52b026 | 227 | bundle and will error out if you do not have them. |
2e0afafe | 228 | |
8aa7eebf | 229 | A bundle from a recipient repository's point of view is just like a |
1d52b026 DM |
230 | regular repository which it fetches or pulls from. You can, for example, map |
231 | references when fetching: | |
2e0afafe | 232 | |
8aa7eebf NS |
233 | ---------------- |
234 | $ git fetch mybundle master:localRef | |
235 | ---------------- | |
2e0afafe | 236 | |
5e1f9605 | 237 | You can also see what references it offers: |
2e0afafe | 238 | |
8aa7eebf NS |
239 | ---------------- |
240 | $ git ls-remote mybundle | |
241 | ---------------- | |
2e0afafe | 242 | |
2e0afafe JS |
243 | GIT |
244 | --- | |
9e1f0a85 | 245 | Part of the linkgit:git[1] suite |