Description
Git bundles pack refs and objects into a single file. Use them to move history without a network remote, or to seed a clone from removable media.
create walks the given revision specs (same rules as grit log), writes prerequisite commits the recipient must already have, lists tip refs in the header, and appends a pack stream. Bundles are detected by the # v2 git bundle / # v3 git bundle signature, not by the .bundle file extension alone.
When the repository's objects are already packed, create copies the existing deltas and whole objects straight from the packs instead of recomputing them, and streams the pack into the file. A bundle of a packed repository is close to a copy of its pack: it takes seconds and its memory is bounded by the pack index, not by the size of the history. Bundles with prerequisites are thin, so an object can be sent as a delta against a prerequisite's blob. Only objects that are not already stored as deltas (for example, loose objects from recent commits) go through a new delta search, as git bundle create does; it covers blobs, trees and commits and reads each object only while it is in the search window.
create and unbundle honor Ctrl+C (and SIGTERM / SIGHUP on Unix) with error: operation cancelled and exit code 130. A failed or cancelled create leaves an existing destination file unchanged and removes only the temporary *.bundle.part file; unbundle rolls back before refs are updated.
verify checks the pack checksum and, when run inside a repository, confirms prerequisite commits are present and their exclusive history is readable. Prerequisites already reachable from your refs satisfy this immediately; otherwise an unreferenced but complete object graph in the repository is enough (for example after unbundle of a full bundle leaves dangling prerequisites).
list prints the refs recorded in the bundle header.
unbundle ingests the embedded pack into the current repository (objects only; refs in the header are reported but not updated on disk). Run inside the destination repository. When prerequisite commits from an incremental bundle are missing locally, unbundle refuses before reading the pack (same checks as verify) with exit 128 and a message listing the missing commit ids—it does not report pack corruption or leave partial objects behind.
You can also treat a bundle path like a remote: grit fetch and grit clone accept a path to a bundle file.
Options
create:
| Argument / flag | Description |
|---|---|
<file> |
Output bundle path. |
--all |
Include HEAD, every branch, and every tag in the bundle header (same idea as git bundle create --all). Omit <rev>… when using this flag. |
<rev>… |
One or more positive revision specs (commits, branches, ranges). Not used together with --all. |
--dry-run |
List refs, prerequisites, and pack object count without writing <file>. |
verify / list / unbundle:
| Argument | Description |
|---|---|
<file> |
Existing bundle file. |
-n, --limit <N> |
For list: print at most N header refs (truncated in JSON when more exist). |
unbundle:
| Option | Description |
|---|---|
--dry-run |
Verify the bundle and report refs that differ from local tips; do not ingest objects or write refs (unbundle never updates refs). |
JSON output
Schema: v1 · bundle.list v1 · bundle.verify v1 · bundle.unbundle v1
grit bundle verify --json:
| Field | Type | Meaning |
|---|---|---|
path |
string | Bundle file path. |
ok |
boolean | Whether verification succeeded. |
hash_algorithm |
string | Object hash used by the pack (sha1 or sha256). |
references |
array | Each entry has name and oid. |
prerequisites |
array of strings | Required commit ids (hex). |
missing_prerequisites |
array of strings | Prerequisite ids absent from the current repo (empty when not in a repo or when ok is true). |
grit bundle list --json:
| Field | Type | Meaning |
|---|---|---|
path |
string | Bundle file path. |
references |
array | Refs from the bundle header (name, oid). |
truncated |
boolean | true when the header held more refs than returned (-n / --limit). |
grit bundle create --json:
| Field | Type | Meaning |
|---|---|---|
path |
string | Output bundle path. |
refs |
number | Count of refs written to the header. |
dry_run |
boolean | true when --dry-run was used (omitted when false). |
object_count |
number | With --dry-run, objects that would be packed. |
references |
array | With --dry-run, planned header refs (name, oid). |
prerequisites |
array of strings | With --dry-run, prerequisite commit ids. |
grit bundle unbundle --json:
| Field | Type | Meaning |
|---|---|---|
path |
string | Bundle file path. |
references |
array | Ref tips from the bundle header (name, oid). |
objects |
number | Objects installed from the pack (omitted on --dry-run). |
bytes |
number | Pack size in bytes (omitted on --dry-run). |
dry_run |
boolean | true when --dry-run was used. |
object_count |
number | With --dry-run, objects in the embedded pack. |
ref_updates |
array | With --dry-run, refs that differ from local tips (name, old_oid, new_oid). |
ok |
boolean | With --dry-run, whether verification succeeded. |
missing_prerequisites |
array of strings | With --dry-run, prerequisite ids absent locally. |
Markdown output
Schema: v1
Pass --markdown on any grit bundle subcommand for the same JSON document wrapped for agents (see Global options).
Exit status
| Code | Meaning |
|---|---|
0 |
Success. |
1 |
Verify failure or other error. |
2 |
Invalid flags (usage). |
128 |
unbundle missing prerequisite commits (missing_prerequisite). |
See Exit codes.