Files
Retribusi/pull.sh

37 lines
917 B
Bash
Raw Normal View History

#!/bin/bash
# Script untuk pull frontend di server production
# Usage: bash pull.sh
echo "🔄 Pulling Retribusi Frontend..."
cd "$(dirname "$0")" || exit
# Cek apakah ini git repository
if [ ! -d ".git" ]; then
echo "❌ Error: Bukan git repository"
exit 1
fi
# Cek branch saat ini
CURRENT_BRANCH=$(git branch --show-current)
echo "📍 Current branch: $CURRENT_BRANCH"
# Stash perubahan lokal jika ada (untuk openapi.json atau file lain yang mungkin berubah)
echo "💾 Stashing local changes (if any)..."
git stash
# Pull dari origin main
echo "⬇️ Pulling from origin/main..."
git pull origin main
# Jika ada stash, coba pop (optional)
if git stash list | grep -q .; then
echo "📦 Restoring stashed changes..."
git stash pop || echo "⚠️ Warning: Ada conflict saat restore stash, silakan resolve manual"
fi
echo "✅ Pull selesai!"
echo ""
echo "📊 Status:"
git status --short