By following these steps you can change the default branch from main to master in your GitHub repository. It is essential to update any references or configurations in your projects or workflows that might be affected by this change to ensure a smooth transition. Pre-Requisites: Ensure that you had a valid GitHub account, an organization, and repositories. NOTE: Please sign in to your GitHub account and then execute this skill.
-
1.
Open GitHub on the web.
-
2.
On the home page click on your "profile picture" and a drop-down will appear.
-
3.
Select "Your organizations" from the drop-down list.
-
4.
You will be on the Organizations page, where all the Organizations that are present will be displayed. First, click on the "Next" button in the Supervity instruction widget. Select the organization by clicking on the organization name.
-
5.
Click on the "Repositories" to pick the repository in which you want to change the default branch.
-
6.
All the repositories related to the selected organization will be displayed. First, click on the "Next" button in the Supervity instruction widget. Navigate to the repository. You can do this by clicking on the repository's name or searching for it using the search bar at the top of the page.
-
7.
Once you're inside the repository, click on the "Settings" tab located towards the top of the page.
-
8.
By default, you will be directed to the "General settings page". First, click on the "Next" button in the instruction widget. If you are not landed on the General settings page, click on the "General" located in the left side panel.
-
9.
Scroll down to the "Default branch" section. Under "Default branch" you will find a "pencil icon" ✏ , click on it to change the default branch.
-
10.
A text box will appear with the current branch name, erase that branch name and type in the new branch name. Usually, the main branch (e.g., master or main) is a common choice. Here we are changing from main to master.
-
11.
Click on the "Rename branch" button. You will be redirected to the repository page and you can see the change in the default branch name.