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.



Have a question? Or, a comment? Let's Discuss it below...


Thank you for visiting our website!

We value your engagement and would love to hear your thoughts. Don't forget to leave a comment below to share your feedback, opinions, or questions.

We believe in fostering an interactive and inclusive community, and your comments play a crucial role in creating that environment.