@@ -8,10 +8,14 @@ SERVICE_NAME=subvortex-auto-upgrader
88SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
99cd " $SCRIPT_DIR /../.."
1010
11+ # Track whether we stashed anything
12+ STASHED=0
13+
1114# Check for uncommitted changes
1215if ! git diff --quiet || ! git diff --cached --quiet; then
1316 echo " 📦 Stashing local changes..."
1417 git stash push -u -m " Auto stash before pull"
18+ STASHED=1
1519fi
1620
1721# Check if branch is tracking a remote
2529
2630# Pull latest changes from upstream
2731echo " 🔄 Pulling latest changes from $UPSTREAM ..."
28- git pull --ff-only
32+ if ! git pull --ff-only; then
33+ echo " ⚠️ Fast-forward pull failed. Trying forced sync with origin/$BRANCH ..."
34+ git fetch origin
35+ git reset --hard origin/" $BRANCH "
36+ fi
37+
38+ # Restore stashed changes if we made one
39+ if [[ " $STASHED " -eq 1 ]]; then
40+ echo " 🧵 Restoring stashed local changes..."
41+ git stash pop || {
42+ echo " ⚠️ Conflicts while restoring stash. You may need to resolve manually."
43+ }
44+ fi
2945
3046# Install python if not already done
3147if ! command -v python3 & > /dev/null; then
@@ -55,6 +71,7 @@ pip install ".[$SUBVORTEX_EXECUTION_ROLE]"
5571# Install SubVortex in Editable Mode
5672pip install -e ../../
5773
74+ # Start or restart the process
5875if pm2 list | grep -qw " $SERVICE_NAME " ; then
5976 echo " 🔄 Restarting PM2 service: $SERVICE_NAME "
6077 pm2 restart " $SERVICE_NAME "
0 commit comments