Sometimes you want to send (e.g. by e-mail) a set of new Git commits to someone else who has the same repository at an older state, without transferring the whole repository and without sharing a common remote repository.
One feature that might come to your mind are Git patches. Patches, however, don’t work when there are branches and merge commits in the commit history: git format-patch creates patches for the commits across the various branches in the order of their commit times and doesn’t create patches for merge commits.
The solution to the problem are Git bundles. Git bundles contain a partial excerpt of a Git repository in a single file.
This is how to create a bundle, including branches, merge commits and tags:
$ git bundle create my.bundle <base commit>..HEAD --branches --tags
<base commit> must be replaced with the last commit (i.e. commit hash or tag), which was included in the old state of the repository.
A Git bundle can be imported into a repository via git pull:
$ git pull /path/to/my.bundle