#!/bin/bash

git stash

set -euo pipefail

git fetch origin

# ensure develop is up to date
git switch develop
git pull --ff-only

# backup current remote main (once per run)
git branch -f backup/origin-main origin/main || true

# make main == develop and push
git switch main
git reset --hard develop
git push --force-with-lease origin main

# go back
git switch develop

git stash pop

