I have a project with a dev branch and a production branch. Recently I've been working on a big new set of features in dev, so I haven't merged into production for about two weeks. In the meantime, though, there were some bugs that needed to be fixed in production.
For the most part I was able to make the fixes in dev and cherry-pick them into production. Sometimes, however, I would need to fix production by hand, as the fixes were substantially different in the two branches. Point is, the two branches have diverged a fair bit since they split.
Now I want to just merge all of dev into production. I don't care about keeping any of the commits in production since the split, I just want production to look exactly like dev since the split, but don't want to rewrite history before the split.
However, when I try to merge I get dozens of conflicts that I'd prefer not to fix by hand.
What's the best way to force a merge in git? Can I revert my production changes back to the split and then just fast-forward to the dev branch?
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.