[Git] Configure default branch from master to main

2021-07-07 hit count image

Let's how to configure the default branch of Git from master to main.


There are many arguments about the master name of the default branch in Git. So, many services decide to drop master for the name of the branch.

However, when we use Gith on Local, the master branch is still the default branch. So, when we create a new Git repository on local, the branch name is master. And then, we should change it to main. In this blog post, I will show you how to change the default branch to main from master to solve this inconvenience.

Git config

You can configure almost all of the Git settings with the git config command. Of course, you can change the default branch name by this command. Execute the command below to change the default branch name from master to main.

git config --global init.defaultBranch main

After executing this command, when you execute the following command to create a new Git repository, you can see the default branch name is main instead of master.

git init


Done! we’ve seen how to change the default branch from master to main. It’s very easy, so I hope you configure this and you join this movement.

Was my blog helpful? Please leave a comment at the bottom. it will be a great help to me!

App promotion

You can use the applications that are created by this blog writer Deku. 지금 보고 계신 블로그를 작성하는 Deku가 개발한 앱을 한번 사용해보세요.
Deku created the applications with Flutter.

If you have interested, please try to download them for free.