By admin , 29 April 2026

Synopsis

git bundle create <file> <git-rev-list-args>
git bundle verify <file>
git bundle list-heads <file>
git clone <file> <dir>

Description

The git bundle command packages Git history into a single file that can be transferred without a network — by USB drive, email, or any file transport. The recipient can clone or fetch from the bundle as if it were a remote. This is invaluable for air-gapped systems, slow connections, or as a backup format.

Bundles support incremental updates: include a base ref so the bundle only contains commits since that ref, then have the recipient apply it on top of an existing repo with git fetch.

In day-to-day use, git bundle integrates closely with shell aliases, editor plugins, and continuous integration. Power users often add aliases that combine flags they always pass, or wrap the command in scripts that enforce team conventions. Output formatting can be customized via Git config — pretty formats, color schemes, and pager behavior are all tunable. When something goes wrong, the first diagnostic step is usually to re-run the command with GIT_TRACE=1 in the environment, which reveals the underlying plumbing calls. For unusual situations, the --help output (git bundle --help) opens the full manual page with details on every option, including those rarely used in casual workflows but essential for debugging or scripting at scale.

Understanding how git bundle interacts with the rest of Git's data model — the object database, the index, refs, and the working tree — pays dividends. Each command operates on some subset of these pieces, and knowing which it touches helps predict outcomes and recover from mistakes. Reading the official Git documentation alongside hands-on practice in a throwaway repository is the fastest way to internalize the nuances. Most production issues with Git stem from one of three causes: surprising default behavior, partial network operations, or rewriting history that was already shared. A working mental model of git bundle's side effects helps avoid all three.

Common Options

SubcommandDescription
create <file> <refs>Create a bundle file.
verify <file>Check that a bundle is valid and applicable.
list-heads <file>List the refs the bundle contains.
unbundle <file>Plumbing: emit objects to the repository.
--allInclude all refs.
--progressShow progress on creation.

Examples

git bundle create repo.bundle --all
# Full backup of every ref

git bundle create incremental.bundle main ^v2.0
# Just commits on main since v2.0

git bundle verify repo.bundle
# Check applicability before fetching

# On the receiving side:
git clone repo.bundle myproj
# or, into an existing repo:
git fetch ../incremental.bundle main:main

Common Mistakes

Creating a bundle without specifying a base means the recipient gets the full history every time, even for small updates. Use ranges like --since or ^<ref> for incremental bundles. git bundle verify against an empty repo only checks structural validity, not whether the bundle's prerequisites are present.

Related Commands

git archive, git fetch, git clone, git pack-objects