![]() ![]() ![]() Can’t I just rename master to main? □Īutomation and development workflows will make renaming master require more effort than just following the first Stack Overflow answer you can find to answer the question. As a result, hosting platforms such as Github or continuous integration systems like Jenkins or TravisCI create workflows that typically use these defaults as release branches. But did you know that Git (the tool) has no technical requirement that you use master as your default branch name? However, because it is the first branch created when you run git init, it’s often the default used. The usage of master is unfortunately deeply ingrained into those who learned how to use git and developed muscle memory. Instead, the name main will be used from now on. Starting October 1st, 2020, Github will officially stop their practice of naming the first branch of new repositories master. If you have existing git repos at Github (or any other git hosting platform), you probably have a branch in your repo named master. Introduction □ What’s in a (branch) name? □ Follow this simple checklist to confidently make these changes and create a seamless experience for yourself and your developer community. Want to migrate your git branches from master to main? Your branch protections, in-progress PRs, and drafts can migrate safely. The next step is to delete the master branch on GitHub.9 steps to rename your default Github branch safely ![]() Now that we have a main branch on our local computer, a main branch up on GitHub, and the default branch on GitHub is the main branch. Nice job! One more step to get, we just need to get rid of the master branch so that the main branch is the only branch. Next, click the arrows to change the default branchĪfter the default branch change, you can go back to the main repo page and see that main is now the default branch. Then on the lefthand menu, click on branches On the main page for your repo, click on settings. We are going to change it so the default repo and the checkmark are next to the main branch. If you go to the main repo page on GitHub and select the branches dropdown menu, you will see two branches listed and a checkmark next to master. You need to do this on GitHub, not on your local computer. You can see which branch you are on using the command below:Ĭhange the default branch on GitHub to main The first step is to create a new branch locally (on your computer) called main. Step 1Ĭreate a new main branch locally, taking the history from master So change all of your GitHub repo names to main. This is confusing and leads to creating new branches that you don't want. Is the master branch in charge of anything? Are other branches subservient to it? And a very practical reason is that since GitHub moved to use main as the default branch, you have to remember when to use git push origin main and when to use git push origin master on a repo-to-repo basis. In addition, the name main just makes more sense. Language in programming, like master, that supports symbols of racism has no place. The reason to use the name main as the default branch on Github and in your local git repos is that it's the right thing to do. Git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main ![]()
0 Comments
Leave a Reply. |