Fix deploy step: git reset --hard destroys .env and local state #38
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The deploy step runs
git reset --hard FETCH_HEADwhich deletes any files not in the repo, including.env(containing all service passwords, S3 credentials, COMMIT_SHA). The subsequentsedon.enveither fails or creates an incomplete.envwith onlyCOMMIT_SHA.This is a data-loss bug — deploying destroys the credentials file that all services need.
Fix
Replace
git reset --hardwithgit fetch && git merge --ff-only FETCH_HEADwhich fails safely if there are conflicts instead of silently destroying state. Or backup/restore.env:Acceptance criteria
.envfile survives deploy step with all existing variables intactCOMMIT_SHAis correctly updateddata/directory and other local-only files are preserved