Mike Griffin

About | Archives | |

Moving Another Branch to Master on Github

I’ve been rewriting my other site over the last few months and I was using a different branch to develop on. It has finally come to the time where I’m happy to release it.

But I ran into a problem, because it has changed so radically, it has veered a long way away from the master branch that was originally there. To fix this I wanted to rename the master branch to something else and move the develop branch to be the new master.

After some searching, I found a site that had instructions on how to do it. It’s a nice simple process and it worked out very easily. I’m going to repeat it here in case the other page ever disappears.

git branch -m master legacy
git branch -m dev master
git push origin :master
git push origin master:refs/heads/master
git push origin legacy:refs/heads/legacy
git push origin :dev

That’s it, there is now a new master and the old master is in a branch called legacy.