skip to content
Notes && Anecdotes
Image by Simon Berger on Unsplash Image by Simon Berger on Unsplash

git: Replace master branch


So, you have a git branch named BESTBRANCH and you have basically made it your master branch?

If you want to get back on track, and make master be identical to BESTBRANCH, do this :

git checkout BESTBRANCH

# Take master things into BESTBRANCH,
# but let BESTBRANCH "win" over master
git merge -s ours master

# Take bestbranch into master
git checkout master
git merge BESTBRANCH

Voilla! Now master is best.