I have two branches in my Git repository:
masterseotweaks(created originally frommaster)
I created seotweaks with the intention of quickly merging it back into master. However, that was three months ago and the code in this branch is 13 versions ahead of master.
It has effectively become our working master branch as all the code in master 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 master branch with those in seotweaks?
I could just delete everything in master and merge, but this does not feel like best practice.
You should be able to use the “ours” merge strategy to overwrite master with seotweaks like this:
The first two steps are a useful precaution to ensure your local copy of master is up-to-date. The result should be that your master is now essentially seotweaks.
(
-s oursis short for--strategy=ours)From the docs about the ‘ours’ strategy:
Update from comments: If you get fatal:
refusing to merge unrelated histories, then change the second line to this:git merge --allow-unrelated-histories -s ours master