Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to replace master branch with experiment branch

Tags:

git

I have two branches: master and experiment. Both of them evolved separately and are very different now. Now I am ready to make experiment branch my master branch.

If I try

git checkout master
git merge experiment

I get tons and tons of error.

What is the easiest way to get experiment branch to become master without loosing all the history of experiment branch.

I have already created a backup of master branch as release 1.0 like this

git checkout master
git checkout -b release_1
like image 817
Nick Vanderbilt Avatar asked Nov 09 '10 13:11

Nick Vanderbilt


1 Answers

Assuming these are private branches (i.e. nobody else is working on them), you can just set master to experiment like this:

git checkout master
git reset --hard experiment

If these are public branches, you'll probably want to merge and resolve conflicts, as Jefromi explains.

like image 77
Mauricio Scheffer Avatar answered Sep 28 '22 06:09

Mauricio Scheffer