Force Sync Master with Dev Branch via Pull Request

Goal: Make master branch identical to dev branch when merge conflicts are unresolvable, using a pull request workflow.

Get the target commit

cd /path/to/repository/root
git checkout dev
git log -n 1

Copy the commit SHA (e.g., b2ed68964660648860bcf41d096e71b5d49226ae).

Create sync branch

git checkout master
git checkout -b sync-with-dev

Replace all content

## Remove everything
git rm -rf .

## Restore from dev commit (replace SHA with your commit)
git checkout b2ed68964660648860bcf41d096e71b5d49226ae -- .

## Restore gitignored files
git checkout b2ed68964660648860bcf41d096e71b5d49226ae -- ':!.git'

Commit and push

git add -A
git commit -m "Sync master with dev"
git push origin sync-with-dev

Create PR from sync-with-dev into master. Merge without conflicts.

Verify sync

git checkout dev
git pull origin master --no-commit --no-ff

No changes should appear—master is now identical to dev.