Replacing master with another Git branch

Posted by Peter J. Jones on

If you’re like Dave O’Neill and find yourself working on a Git branch that has diverged from master to the point that a merge would make Linus Torvalds cry, why not just replace master? Dave provides step by step instructions in this article:

Over time, master diverged significantly from the current maintenance branch. Recently, we decided to rebase our development work on the maintenance branch, but there were just too many ugly conflicts to resolve. As we didn’t want to keep all of the code on that branch anyway, the easiest solution was to rename our 2.63-branch to master and resume development there, cherry-picking some of the useful things from the development branch.

About the Author

Peter J. Jones has been a professional software engineer for over 20 years and is deeply passionate about helping programmers improve the skills of their craft. He is the author of Effective Ruby: 48 Specific Ways to Write Better Ruby. Peter can be reached through our contact page or his twitter account.