git bundle

Administration

Pack commits and branches into a single file


The 'git bundle' command packs commits, branches and tags into one file. The file behaves like a remote: you can clone from it or fetch from it. It is how you move a repository without network access — on a USB stick, by email, into an isolated network. An incremental bundle (A..B) only carries newer commits and requires the older ones on the receiving side.

Synopsis

git bundle create <file> <git-rev-list-args>
git bundle verify <file>
git bundle list-heads <file>
git bundle unbundle <file>
[ ] optional| or<arg> placeholder... repeatable--flag option

Options

Click any option to expand

Beginner (2)

Check a bundle: its refs, what it requires, and whether this repository can use it.

RecommendedMake sure the bundle is complete for this repository

Example

git bundle verify shop.bundle

List the branches and tags inside a bundle.

When neededSee what you can fetch from a bundle

Example

git bundle list-heads shop.bundle

Choosing the Right Option

Ways to move a repository

With and without network

CommandNeeds network
git push / git clone <url>Yes
git bundle + copy the fileNo

Examples

Pack a branch

git bundle create shop.bundle main

Every commit of main.


Clone from it

git clone shop.bundle shop

A repository from the file.


Incremental

git bundle create update.bundle v1.0..main

Only commits after v1.0.

Workflow Examples

1
git bundle create shop.bundle --all

Pack everything

2
git clone shop.bundle shop

Unpack it on the other computer

Troubleshooting

error: Repository lacks these prerequisite commits

Cause: The bundle is incremental

Get a full bundle, or fetch the missing history first

Tips & Pitfalls

Best Practices

  • ✓Run git bundle verify before sending a bundle.

Common Mistakes

  • ✗Creating an incremental bundle for someone who lacks the older commits — verify tells you what is required.

FAQ

A:

It can be: git bundle create backup.bundle --all captures every branch and tag.