How to Set the Default GitHub Branch to 'master'
A simple guide to reverting the default GitHub branch from 'main' to 'master'.

Consider this scenario where you create a new Git repository using the command-line tool.
$ mkdir new-repo
$ cd new-repo
$ git init
Initialized empty Git repository in /Users/junian/new-repo/.git/
$ touch README.md
$ git add .
$ git commit -m "Init"
[master (root-commit) d088569] Init
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README.md
$ git status
On branch master
nothing to commit, working tree clean
As you can see, the git CLI still defaults to the master branch. I respect that and am fine with it.
If you want consistency between the Git command-line tool and GitHub when creating a new repository, you may prefer to use master as the default branch. By default, GitHub now uses main as the default branch, but you can easily change it back to master.
Follow these steps:
- Open your GitHub account Settings.
- Navigate to the Repositories tab on the left, and find the Repository default branch section.
- Set your preferred default branch name, such as
master. - Click Update to save the changes.
The next time you create a new repository, GitHub will use your chosen default branch name instead of main.
For a visual walkthrough, watch the video below:
That’s all for today. As usual, thanks for reading, and see you soon!
