I had a similar issue in Replit where my local got out of sync with Git. I opted to go with the local discard any differences. Steps below. All executed in the Shell.
~/workspace$ rm -f .git/index.lock
~/workspace$ git rebase --abort
~/workspace$ git fetch origin
~/workspace$ git branch backup-main origin/main
~/workspace$ git checkout main
~/workspace$ git add -A
~/workspace$ git commit -m "Replace codebase with latest local version"
~/workspace$ git push --force-with-lease origin main