git pull: replace reset --hard + clean -fd with --ff-only

This commit is contained in:
Gmer4Lfe
2026-06-05 19:24:48 -04:00
parent a5936331c9
commit 437c525fbd
+5 -9
View File
@@ -208,19 +208,15 @@ else
# Uses conf files already present from last pull to determine exclusions # Uses conf files already present from last pull to determine exclusions
configure_sparse_checkout "$TARGET_DIR" configure_sparse_checkout "$TARGET_DIR"
log "git reset --hard"
git reset --hard
log "git clean -fd"
git clean -fd
echo " Pulling latest changes..." echo " Pulling latest changes..."
if GIT_SSH_COMMAND="ssh -i $GITEA_SSH_KEY -p $SSH_PORT" git pull; then if GIT_SSH_COMMAND="ssh -i $GITEA_SSH_KEY -p $SSH_PORT" git pull --ff-only; then
echo " Git pull successful" echo " Git pull successful"
SYNC_SUCCESS=true SYNC_SUCCESS=true
else else
error "Git pull failed" # ff-only fails when local commits or tracked changes exist that can't
notify "Git pull failed on $(hostname) — check Gitea connectivity" "Git Sync" "alert" # fast-forward. Fail loudly — never silently destroy local work.
error "Git pull failed — local changes conflict with remote (will not force-reset)"
notify "Git pull failed on $(hostname) — local changes conflict, manual resolve needed" "Git Sync" "alert"
exit 1 exit 1
fi fi