myiopsitta-monachus-audios / batch_commit.sh
juliogu81's picture
Agregar clips de audio procesados (lote 1: 100 archivos)
7039cc5
raw
history blame
1.16 kB
#!/bin/bash
# Script para hacer commits de a 100 archivos
# Uso: ./batch_commit.sh "mensaje del commit"
if [ $# -eq 0 ]; then
echo "Uso: $0 \"mensaje del commit\""
exit 1
fi
COMMIT_MESSAGE="$1"
BATCH_SIZE=100
echo "Iniciando commits en lotes de $BATCH_SIZE archivos..."
echo "Mensaje del commit: $COMMIT_MESSAGE"
# Obtener archivos modificados/agregados/eliminados
git status --porcelain | grep -E '^(A|M|D|R|C|U|T)' | cut -c4- | while read -r file; do
# Agregar archivo al staging
git add "$file"
# Contar archivos en staging
staged_count=$(git diff --cached --name-only | wc -l)
# Si llegamos a 100 archivos, hacer commit
if [ "$staged_count" -ge "$BATCH_SIZE" ]; then
echo "Haciendo commit de $staged_count archivos..."
git commit -m "$COMMIT_MESSAGE (lote de $staged_count archivos)"
fi
done
# Commit final con los archivos restantes
remaining=$(git diff --cached --name-only | wc -l)
if [ "$remaining" -gt 0 ]; then
echo "Haciendo commit final de $remaining archivos..."
git commit -m "$COMMIT_MESSAGE (lote final de $remaining archivos)"
fi
echo "¡Todos los commits completados!"