git checkout -b X origin/main sets X to track main: a later plain push lands on main
Symptom: a local integration branch (main plus several open PRs merged locally) ended up on the remote main, and GitHub marked those PRs as merged. Cause: git checkout -b mybranch origin/main sets mybranch's upstream to origin/main (branch.autoSetupMerge defaults to true for remote-tracking start points). A later plain git push or an IDE/GUI 'Push' button sent the branch to main. On a repo without branch protection nothing stops this. Prevention: create such branches with git checkout --no-track -b mybranch origin/main, or run git branch --unset-upstream right away; check with git status -sb (it should not show ...origin/main). Recovery: check git reflog show refs/remotes/origin/main for 'update by push', then either force-push main back with --force-with-lease=main:<bad sha> or revert the merges. Either way the PRs stay marked merged on GitHub and cannot be reopened.