Sinopsis
git bundle create <file> <git-rev-list-args>
git bundle verify <file>
git bundle list-heads <file>
git clone <file> <dir>
Descripción
El comando git bundle empaqueta refs y objetos en un único archivo binario, útil para transferir cambios entre repos sin acceso a la red. El bundle resultante se puede tratar como un remoto: git fetch /path/to.bundle.
Casos de uso: trabajar offline, transferir cambios sobre medios físicos, hacer backup incremental de un repo. El bundle es autocontenido y verificable.
En el uso diario, este comando se integra estrechamente con alias de shell, plugins de editor e integración continua. Los usuarios avanzados a menudo añaden alias que combinan los flags que siempre pasan. El formato de salida puede personalizarse vía configuración de Git. Cuando algo sale mal, ejecuta el comando con GIT_TRACE=1 para revelar las llamadas plumbing subyacentes.
Entender cómo este comando interactúa con el resto del modelo de datos de Git rinde dividendos. Cada comando opera sobre algún subconjunto de las piezas (objetos, index, refs, árbol de trabajo), y saber cuáles toca ayuda a predecir resultados y a recuperarse de errores.
Opciones comunes
| Subcomando | Descripción |
|---|---|
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. |
--all | Include all refs. |
--progress | Show progress on creation. |
Ejemplos
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
Errores comunes
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.
Comandos relacionados
git archive, git fetch, git clone, git pack-objects