Por Anónimo (no verificado) , 29 Abril 2026

Sinopsis

git unpack-objects [-r] [-q] < <pack-file>

Descripción

El comando git unpack-objects es la inversa de pack-objects: lee un archivo pack y explota cada objeto a un archivo suelto bajo .git/objects/. Útil para depurar packs corruptos o para inspección de bajo nivel.

Después de explotar, los objetos están en forma suelta hasta que git gc los reempaqueta. Útil para extraer un solo objeto malo de un pack que de lo contrario está derribando operaciones.

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.

Cuándo usar

Most developers never need this. It's used for recovering from a corrupt pack (unpack what's salvageable, then re-pack), for testing, or when integrating a small bundle into a repo where the loose-object format is preferable.

Opciones comunes

OpciónDescripción
-nDry-run: show what would be unpacked.
-qQuiet, no progress.
-rRecover what's possible from a damaged pack.
--strictRefuse to write objects with broken links.

Ejemplos

git unpack-objects < pack-abc.pack
# Explode pack into loose objects

git unpack-objects -r < broken.pack
# Salvage what we can from a damaged pack

git unpack-objects -n < somepack.pack
# Just preview what would be unpacked

Errores comunes

Unpacking a huge pack creates many tiny files and slows the filesystem. Almost every operational scenario prefers keeping the pack intact. Pair this with git fsck when troubleshooting corruption. git help unpack-objects opens the full manual page with comprehensive coverage of every option and edge case; it remains the authoritative reference whenever the summary on this page leaves a question unanswered. For team workflows, capturing how your project uses this command in a CONTRIBUTING document avoids repeated onboarding questions and keeps everyone aligned on conventions.

Comandos relacionados

git pack-objects, git verify-pack, git fsck, git gc