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
master to solve this inconvenience.
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
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
Done! we’ve seen how to change the default branch from
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!