¿Cómo maneja git los archivos binarios?


  • ¿Tengo que establecer algo para decirle a git si algunos archivos son binarios, al igual que svn? ¿O bien, git solo puede manejar datos binarios automáticamente?
  • Si cambio el archivo binario, para que tenga 100 revisiones binarias, ¿git almacenará las 100 versiones individualmente en el repositorio?
  • ¿Para qué sirven los submódulos con git?
Author: Tetsujin no Oni, 2010-08-30

5 answers

  1. Git generalmente puede detectar archivos binarios automáticamente.
  2. No, Git intentará almacenar conjuntos de cambios basados en delta si es menos costoso para (no siempre es el caso).
  3. Los submódulos se usan si quieres hacer referencia a otros repositorios de Git dentro de tu proyecto.
 49
Author: Amber,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-08-30 15:16:08

Git usa una heurística para tratar de determinar si un archivo es un binario. Consulte este artículo para obtener más información y cómo forzar a git a tratar un archivo dado como un binario.

Para un buen tutorial sobre submódulos ver aquí y aquí.

 19
Author: Jason Jenkins,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-07-28 05:26:02

Tenía esencialmente el mismo problema: quería git pickle archivos, que son binarios, pero git piensa que son de texto.

Encontré este capítulo sobre los atributos de Git en el libro Pro Git. Así que resolví mis problemas creando un archivo .gitattributes con esta línea:

*.pickle binary
 10
Author: Alexandre Mazel,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-05-08 13:28:44
git add my-binary-file
git commit
git push

Agregará su archivo binario; es automático.

De hecho, si tiene 100 versiones de su archivo, lo almacenará (pero comprimido).

Puede usar submódulos para hacer referencias a otros repositorios.

 4
Author: Guillaume Lebourgeois,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-07-20 17:39:03

El problema es con .gitignore

Las siguientes rutas son ignoradas por uno de sus .archivos gitignore: XXX/AAAA / Bin1_0x1d_0x0d.bin

Usa-f si realmente quieres añadirlos.

Git add-f XXX/YYYY/*

O

Git add-f XXX / YYYY / Bin1_0x1d_0x0d. bin

 -1
Author: ashish,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-04-27 05:28:48