DiscoverFront-End Web DailyTuesday Tips | How to Rename Your Master Branch on GitHub
Tuesday Tips | How to Rename Your Master Branch on GitHub

Tuesday Tips | How to Rename Your Master Branch on GitHub

Update: 2020-09-08
Share

Description

Today is September 8, 2020, and for this Tuesday Tips episode we're covering How to Rename Your Master Branch on GitHub


Let's dive in!


----


Recent events have brought to light the negative connotations of having the main branch on a repository called master. Whether you want to change your primary branch name for this reason or just for fun, it is important to know how to do so and there are a few key steps to ensure that the change goes smoothly.


----


Before we jump into changing our existing repos, let's make sure that we avoid the issue altogether in our future projects. In GitHub, under Settings > Repositories there is an option to name your default branch for future projects. Remember, this changes it for your personal account, but you can do the same for an organization.


As a note, on October 1st of this year, GitHub will be setting the default branch for new repositories to main.


----


Now, to change an existing repo to a new name add a new branch from the existing master, which we will call main for this example. With an exact copy now on main go to the repository Settings > Branches and change the default branch to main. Then we can delete the master branch, which will alert us that the open pull requests for master will be affected. You can use a tool, like this one from Edward Thomson, to re-target the pull requests to the new branch.


And that's it! You've made the change away from the master branch. If you still think it sounds a bit too complicated or too much work, GitHub announced that it will be releasing a feature to make a seamless transition when renaming the default branch by the end of the year.


----


Today's Tuesday Tips was adapted from a post on the DEV Community.


----


Want to know more? Head to fewdaily.com for more of today’s topics and other front-end web content! If you liked what you heard be sure to rate, review, and subscribe on your platform of choice. That's all for today, tune in tomorrow!

Comments 
In Channel
loading
00:00
00:00
x

0.5x

0.8x

1.0x

1.25x

1.5x

2.0x

3.0x

Sleep Timer

Off

End of Episode

5 Minutes

10 Minutes

15 Minutes

30 Minutes

45 Minutes

60 Minutes

120 Minutes

Tuesday Tips | How to Rename Your Master Branch on GitHub

Tuesday Tips | How to Rename Your Master Branch on GitHub

Front-End Web Daily