Skip to content

Git Set Initial Branch Name

Git set initial branch name

When you initiate a new repository, the name of the main branch is automatically set as master.

Many people have become aware that the terminology master/slave should be replaced with something more appropriate.

Most companies choose to name the main branch as main.

So let’s do that!

🎥 Prefer a video guide instead? Check this out:


Set initial branch name

In the command line run the following command:

git config --global init.defaultBranch main

This command will add a new configuration to your ~/.gitconfig file.

From now on, when you initiate a new repository, the name of the main branch will be main.


Let me know what you think about this article in the comments section below.

If you find this article helpful, please share it with others and subscribe to the blog to support me, and receive a bi-monthly-ish e-mail notification on my latest articles.   
  

Comments

Tags: