Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Promote Git branch to master

Tags:

git

github

I have a git (and Github) repo with a master branch, a development branch and several feature branches. Each of the feature branches have been branched off development and subsequently merged into development.

I'd now like to "promote" development to master. I don't want to merge these two branches because conflicts may arise. Essentially, development is "production ready" and I'd like for master to reflect the current state of development. How can I do this?

like image 939
Paymahn Moghadasian Avatar asked Feb 04 '15 18:02

Paymahn Moghadasian


1 Answers

In other words, develop is your new master. The easiest way to do that would be to simply push developer to master:

 git push origin origin/development:master

This will work if development started from current master. If not, and you don't want to keep the history of the master you can force the push:

git push -f origin/development:master 

The problem with the forced push might arise if there is other work (branches) forked from master. In such case the safest approach would be to do a technical merge as described in the answers to earlier mentioned thread.

like image 169
Mykola Gurov Avatar answered Sep 28 '22 08:09

Mykola Gurov