Git 2.28 has been released with new features, enhancements and bug fixes. The new feature includes the option to set the default branch name to the global configuration file for the repositories that are being created by the user.

 

So, as an administrator, you can now specify whether you will go with the default "master" branch or a custom branch name, and here's how you can specify it.

 

Git now allows you to set default branch name for new repositories

 

Git now allows you to specify the default branch name for new repositories. But for this to work, you have to use Git 2.28.0 or higher. With the announcement of the Git 2.28.0 release, the company also announces the new configuration option.

 

Prior to Git version 2.28, whenever you create a new repository, an initial first branch named "master" gets created automatically. Now, you can specify init.defaultBranch to override the hard-coded term.

 

You can specify the configuration variable by typing the following command:

$ git config --global init.defaultBranch [BRANCH_NAME]

$ git config --global init.defaultBranch Development

 

In the above scenario, "Development" is the new branch that will be created when you run "git init" to create a new repository. Existing branches will have no impact due to this change.

 

Apart from this, Git 2.28.0 also brings some more new features and enhancements. Check out the original release notes to get an idea of what has been changed since 2.27.

 

 


Kunal Chowdhury

About the Author

Solution Architect & Former Microsoft MVP

Kunal Chowdhury is an enterprise solution architect and former multi-year Microsoft MVP. He is the author of three technical books: Windows Presentation Foundation Development Cookbook, Mastering Visual Studio 2017, and the Mastering Visual Studio 2019.

He publishes technical and non-technical articles on .