33 lines
1.1 KiB
Bash
Executable File
33 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
LOG="/home/debian/Gestion_sondes/Logs/update_product.log"
|
|
REPO_PATH="/home/debian/Gestion_sondes"
|
|
DATE=$(date '+%Y-%m-%d %H:%M:%S')
|
|
|
|
echo "[$DATE] 🔄 Lancement du script de mise à jour" >> $LOG
|
|
|
|
cd $REPO_PATH || { echo "❌ Dossier introuvable : $REPO_PATH" >> $LOG; exit 1; }
|
|
|
|
# Vérifie s'il y a une fusion en cours
|
|
if [ -d .git ] && [ -f .git/MERGE_HEAD ]; then
|
|
echo "[$DATE] ❌ Fusion en cours détectée. Abandon automatique." >> $LOG
|
|
echo "➡️ Lancez 'git merge --abort' manuellement si besoin." >> $LOG
|
|
exit 1
|
|
fi
|
|
|
|
# Récupération des dernières modifications distantes
|
|
git fetch origin >> $LOG 2>&1
|
|
|
|
# Réinitialisation de la branche product sur la version distante
|
|
git checkout product >> $LOG 2>&1
|
|
git reset --hard origin/product >> $LOG 2>&1
|
|
|
|
# Fusion directe depuis origin/develop
|
|
git merge origin/develop -m "🧩 Merge auto develop → product" >> $LOG 2>&1
|
|
|
|
# Push vers le dépôt distant
|
|
git push origin product >> $LOG 2>&1
|
|
|
|
DATE_END=$(date '+%Y-%m-%d %H:%M:%S')
|
|
echo "[$DATE_END] ✅ Mise à jour terminée avec succès." >> $LOG
|