THE GITHTML FIELD GUIDE
Create and verify a Git bundle for offline transfer
A Git bundle packages selected repository objects and references into a file that another Git repository can read without a server. Use a full-reference bundle for a committed-history transfer, verify it, and test a separate clone. A bundle is not a complete working-directory backup: uncommitted files, repository configuration, and external storage need separate handling.
Decide what the backup must contain
A repository backup and a working-folder backup answer different needs. A bundle can preserve reachable committed history and references included by the command. It does not automatically capture your editor’s unsaved buffers, untracked local files, hooks, hosting-service issues, or remote assets stored outside ordinary Git objects. Git LFS content and submodule repositories require their own consideration.
Before creating the bundle, inspect status and inventory any work that exists only in the checkout. Preserve that work separately or commit an appropriate checkpoint when allowed. A full bundle can also include sensitive historical content, so store and transfer it with the same confidentiality controls as the repository rather than treating it as a harmless compressed attachment.
Create outside the source repository and verify
Choose a new, explicit destination that will not overwrite an existing backup. The example uses a sibling filename and a separate test-clone directory; confirm both are available first. --all selects refs known locally, which is not a guarantee that every remote branch has been fetched. Update remote knowledge deliberately if the transfer requires it.
- Compare the bundle’s listed references with the branches and tags you intended to preserve. A valid file can still have an incomplete scope.
- Inspect the test clone’s history and representative files without running unfamiliar project code. A restore rehearsal provides stronger evidence than file size alone.
git status --short
git bundle create ../project-2026-11-23.bundle --all
git bundle verify ../project-2026-11-23.bundle
git bundle list-heads ../project-2026-11-23.bundle
git clone ../project-2026-11-23.bundle ../project-restore-checkDocument the transfer’s limits
Record when the bundle was created, which repository it came from, whether remote refs were refreshed, and which external items were preserved separately. Incremental bundles can depend on prerequisite commits, so they need a carefully documented chain; a self-contained transfer is simpler for occasional offline handoffs.
Keep the source checkout until the receiving side verifies the required history and files. Do not assume a successful clone reproduced hosting permissions, pull requests, release assets, or local tool configuration. Those belong to other systems. A useful backup has a tested recovery path and a clear inventory of exclusions. If the goal is only sharing the current source snapshot, an archive may be simpler, but it should not be mistaken for a replacement for the history that a bundle preserves.
A second copy on the same failing disk is not an independent disaster-recovery backup. Choose storage appropriate to the failure you are trying to protect against.
Sources and further reading
AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.