ITSERR_workbench/push_in_chunks.sh

50 lines
1.1 KiB
Bash

#!/usr/bin/env bash
set -e
BASE="02_da_classificare/__Deliverables"
# Trova tutte le sottocartelle di livello 1 (D1.1, D1.2, …)
dirs=$(find "$BASE" -maxdepth 1 -mindepth 1 -type d | sort)
echo "Trovate cartelle:"
echo "$dirs"
echo
echo "Avvio commit+push per ogni pezzo..."
echo
for d in $dirs; do
echo "------------------------------------------------------------"
echo "Processing: $d"
echo "------------------------------------------------------------"
# Aggiungi solo quella cartella
git add "$d"
# Se non ci sono modifiche, salta
if git diff --cached --quiet; then
echo "Nessuna modifica in $d → salto."
continue
fi
# Commit
msg="Commit automatico: $(basename "$d")"
git commit -m "$msg"
# Push
echo "Pusho..."
if git push; then
echo "OK → $d"
else
echo "❌ ERRORE: impossibile pushare $d"
echo " → PROBABILMENTE TROPPO GRANDE"
echo " → Lo rimuovo dallo staged e continuo..."
git reset HEAD~1
fi
echo
done
echo "------------------------------------------------------------"
echo "Processo completato."