What’s the best way to force a merge in git?

You can just push your dev branch onto the master repo production branch:

git push --force upstream-remote dev:production

upstream-remote may just be origin if you’re on a default clone.

Updated for mod’ed question:

You probably don’t want to revert in the git sense but, yes, that’s more or less what you want to do. Something like

git checkout -b merge <split hash>
git merge dev
git push --force origin merge:production

<split hash> was the last commit on production that you want to keep.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)