Jason Jason - 1 year ago 133
Git Question

How to replace master branch in git, entirely, from another branch?

Possible Duplicate:

Change the current branch to master in git

I have two branches in my git repo:

  1. master

  2. seotweaks (created originally from master)

I created
with the intention of quickly merging it back into
, however that was 3 months ago and the code in this branch is 13 versions ahead of
, it has effectively become our working master branch as all the code in
is more or less obsolete now.

Very bad practice I know, lesson learned.

Do you know how I can replace all of the contents of the
branch with those in

I could just delete everything in
and merge, but this does not feel like best practice.

Answer Source

You should be able to use the "ours" merge strategy to overwrite master with seotweaks like this:

git checkout seotweaks
git merge -s ours master
git checkout master
git merge seotweaks

The result should be your master is now essentially seotweaks.