bundle Git Command Guide
The git bundle command creates archives (bundles) of Git objects to transfer repositories or updates without network access. Bundles can be used to clone from, push to, or pull from remote repositories offline.
git bundle Syntax:
Section titled “git bundle Syntax:”git bundle create <file> <let>..<ref>git bundle verify <file>git bundle list-heads <file> [<refs>...]git bundle unbundle <file> [<refs>...]Commands:
Section titled “Commands:”| Command | Description |
|---|---|
| create | Create a bundle file |
| verify | Check if bundle is valid |
| list-heads | List references in bundle |
| unbundle | Extract objects from bundle |
Parameters:
Section titled “Parameters:”| Parameter | Description |
|---|---|
| Bundle file to create, verify, or read from | |
| Range of commits to include in bundle |
git bundle Command Samples:
Section titled “git bundle Command Samples:”Create a bundle of recent commits
Section titled “Create a bundle of recent commits”git bundle create repo.bundle HEAD~10..HEADCreates a bundle with the last 10 commits.
Clone from a bundle
Section titled “Clone from a bundle”git clone repo.bundle repo-copyClones a new repository from the bundle file.
Verify bundle integrity
Section titled “Verify bundle integrity”git bundle verify repo.bundleChecks if the bundle is valid and complete.
List heads in bundle
Section titled “List heads in bundle”git bundle list-heads repo.bundleShows the references contained in the bundle.
Unbundle into current repository
Section titled “Unbundle into current repository”git bundle unbundle repo.bundleExtracts objects from bundle into the Git object database.
How do I create a Git bundle?
Section titled “How do I create a Git bundle?”To create a bundle, use:
git bundle create <bundle-file> <ref>How can I clone from a Git bundle?
Section titled “How can I clone from a Git bundle?”To clone from a bundle, run:
git clone <bundle-file> <directory>How do I verify a Git bundle?
Section titled “How do I verify a Git bundle?”To verify a bundle file, execute:
git bundle verify <bundle-file>How do I list references in a bundle?
Section titled “How do I list references in a bundle?”To list references in a bundle, use:
git bundle list-heads <bundle-file>How can I unbundle a Git bundle?
Section titled “How can I unbundle a Git bundle?”To unbundle objects into the current repository, run:
git bundle unbundle <bundle-file>Applications of the git bundle command
Section titled “Applications of the git bundle command”- Creating offline repository backups for transfer
- Distributing Git repositories without network access
- Sharing repository snapshots over removable media
- Cloning repositories from archived bundles
- Verifying bundle integrity before use