Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to use git bundles

Let machine M be the Main machine with the repo, and A the Auxiliary machine which wants to help out.

First time setup

  1. Machine M creates bundle with complete repo:
git bundle create repo.bundle HEAD master
  1. M sends repo.bundle to A.
  2. A clones repo from bundle:
git clone repo.bundle repo

A sends commits to M

  1. A checks with
git log --oneline master ^origin/master

that the correct commits are shown that are added. 2. A puts them in a bundle with

git bundle create commits.bundle master ^origin/master

Note that both master and origin/master could be replaced with commit refs.

  1. A sends bundle to M, M optionally checks bundle with git bundle verify commits.bundle
  2. M pulls commits to new branch other-master with
git pull commits.bundle master:other-master
  1. M could merge the branch.


M could add the bundle file as a remote, if the filename is always the same. M would git remote add bundle commits.bundle where bundle is the name of the remote. Beware that the path commits.bundle is relative to the repository top level! M can then git pull bundle.


git book


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment