Git Pro Doku: https://git-scm.com/book/en/v2/Git-Tools-Bundling
git bundle command you can bundle a certain count of commits from a repository into a file to transfer it per e-mail or simply on an usb-stick. This command is very useful if you have no network connection or in other special circumstances.
Lets say we have a repository on a machine without a network connection. We added some new commits and want to apply these changes to the main repository on another machine B.
We can bundle just the changes we want with the following command.
$ git bundle create commits_2017-06-26_0913.bundle master ^bb1d Counting objects: 351, done. Delta compression using up to 2 threads. Compressing objects: 100% (346/346), done. Writing objects: 100% (351/351), 4.25 MiB | 8.00 MiB/s, done. Total 351 (delta 264), reused 0 (delta 0)
In this command,
commits_2017-06-26_0913.bundle is the filename of the saved bundle.
master ^bb1d specifies the range of commits we want bundle. The bundle contains all changes to the repository in a compressed form (a ZIP of the bundle gains no extra compression) and we can easily send it per e-mail or copy it on an usb-stick.
Befor we can
pull the bundle into the repository on machine B, we can verify that the bundle fits to it.
$ git bundle verify ../commits_2017-06-26_0913.bundle The bundle contains this ref: e2ce2ba9247613c080aa6e4f40cfa174905ba0f8 refs/heads/master The bundle requires this ref: bb1d7119bd33f9e93be08daf9cf6dab4da51b1c5 ../commits_2017-06-26_0913.bundle is okay
The message says the bundle is OK and fits to the target-repository. Now we can
pull it like any other changes.
$ git pull ../commits_2017-06-26_0913.bundle master Receiving objects: 100% (351/351), 4.25 MiB | 0 bytes/s, done. Resolving deltas: 100% (264/264), completed with 86 local objects. From ../commits_2017-06-26_0913.bundle * branch master -> FETCH_HEAD Updating f2d32a9..e2ce2ba Fast-forward