File size: 1,353 Bytes
c5c471b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash

# Script simple para hacer commits de a 100 archivos
# Uso: ./simple_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
counter=0

echo "Iniciando commits en lotes de $BATCH_SIZE archivos..."

# Obtener lista de archivos modificados (sin espacios al inicio)
files=$(git status --porcelain | sed 's/^...//')

# Contar total de archivos
total_files=$(echo "$files" | wc -l)
echo "Total de archivos a procesar: $total_files"

# Procesar archivos en lotes
echo "$files" | while IFS= read -r file; do
    if [ -n "$file" ]; then
        git add "$file"
        counter=$((counter + 1))
        
        # Si llegamos a 100 archivos, hacer commit
        if [ $((counter % BATCH_SIZE)) -eq 0 ]; then
            batch_num=$((counter / BATCH_SIZE))
            echo "Haciendo commit del lote $batch_num (archivos $((counter - BATCH_SIZE + 1))-$counter)..."
            git commit -m "$COMMIT_MESSAGE (lote $batch_num: $BATCH_SIZE archivos)"
        fi
    fi
done

# Commit final con los archivos restantes
remaining=$((counter % BATCH_SIZE))
if [ $remaining -gt 0 ]; then
    echo "Haciendo commit final de $remaining archivos..."
    git commit -m "$COMMIT_MESSAGE (lote final: $remaining archivos)"
fi

echo "¡Todos los commits completados!"