Dos formatos, dos propósitos
git archive produce una instantánea tar o zip de un tree — código sin historia, perfecto para releases. git bundle produce un archivo de transporte portable que contiene objetos y refs — perfecto para transferencia offline de un repo entero.
Ejemplos de archive
git archive --format=tar.gz -o release-1.0.tar.gz v1.0.0
git archive --format=zip --prefix=myapp-1.0/ -o myapp-1.0.zip HEAD
git archive --format=tar HEAD src/ | tar -xC /tmp/snapshot
Excluir archivos
tests/ export-ignore
.github/ export-ignore
*.dev.json export-ignore
Bundle para transferencia offline
git bundle create repo.bundle --all
git bundle create incr.bundle main ^origin/main
git bundle verify repo.bundle
git clone repo.bundle myrepo
git fetch repo.bundle main:imported
Caso de uso: enviar a cliente bajo embargo
git bundle create v1.2.bundle main --tags
git fetch v1.2.bundle '+refs/heads/*:refs/remotes/upstream/*' '+refs/tags/*:refs/tags/*'
Archivos reproducibles
git archive --format=tar.gz \
--output=src.tar.gz \
--prefix=src/ HEAD
Errores comunes
Confundir git archive (sin historia) con git bundle (historia completa). Olvidar --prefix produciendo una "tarbomb."